It's confusing that the editor is now stored in keyDownEditor and sessionEditor. The sessionEditor var should be converted to a boolean flag called something like inSession . Cases that need to compare sessionEditor to the editor parameter can now use keyDownEditor.