reorganized main program and options