added commandline arguments and other improvements