created looping functions.