improve lex helper