Refactor key -> lex