added loop to main