added runtime command line options, cleaned up code