added command line switches
now can run just one phase
probably made some changes here.