Added game loop and minor fixes.