fine tune looping functions