Adding command line arguments, cleaning up code