Refactored ESC key listeners