Refactored parsing into it's own class

And added a few tests