Refactored Lexer