Cleaned up command-line parsing code

Fixes #68