updated loop

updated function loop