added an Input Handler

added a handler that detects when key is pressed
tidied up the code (basic)