Added looping to main.