add input handler, fix game loop functionality