updated game loop, added input handler