More efficient if statements in _keyEvents()