updated example so that it loops multiple times