new way to use the loop; untested