Fixed minor errors in parser, added more test cases.