Added tests and minor changes to psf.py