improve code quality, add commandline options