Cleanup the analyze posts function a bit