added commandline parsing, added debugging output