modified loop processing