removed unused code, added CONST parameters, added command line argument