Added loop function to replace main function in game class