Added basic error handling for parser, added basic test cases.