main function is a for loop