aacps: move some loops to function pointers