Fixed a few NullPointerExceptions
Added parser tests
More refactoring