loop refinement, it overlaps a bit, but works.