added tests and fixed the parser