added support for command line args
reformatted some code