removed unnecessary imports
added command-line parsing & minor changes and bugfixes