added nearly complete lex() loop