Updated the parser and added a lexer

slightly more robust and cleaner now