Make module export something

Refactor for testability
Have the module export the parser
Have the module run as a script only when invoked as main