Implemented better handling of command line arguments