Made utility function better at blocking loops.