Started refactoring to use own option parser instead of getOpt