Tidy up build_lex_table function