Fixed compilation errors and updated the game loop.