Added a basic game loop and some even handling code