Refactor and implement enter keyboard press