added counting psf counts
beginning of more local files etc