Refactored out lexer code