Added some tests and command line parsing