major refactor of Lexer