put game loop in main, fixed bugs