Added 'loop' function.