Improved lexer