Refactored JS slightly. Added additional support for WASD key presses