Move AP parameter filling into a helper function