refining loop