Refactoring parser, adding testsuite for easy test running