Refactor to separate loops complete.