Added isInterrupted check to break tight loops.
Added isInterrupted check to break tight loops.