switched to class definition of lexer