Modified create_psf function