Introduced object for directions and player.
Reducing global scope.
Refactored input handling.
Refactored input handling.