Refactor Lexer and Parser