fixes a bug in finding xmin
makes some parameters adjustable
adds fsp_main