Lexer refactoring