Clean up PSF photometry code a bit