Add command line option parser and begin refactoring