Moved command line parsing to separate function