Refactoring for Space key actions