Continue updating the code. Moved psf selction to another file