Handling the player's input