added close loop