Refactor player input handling