Move parser to a package, and extract main function out of parser module