Made command line parsing more robust