refactored deadling with keypress on enter events