Merge "Rework the loop state"