Cleanup, and added command line options