refactor break logic