cleaned up the lex_print function