Bug fixes and some new command line arguments