Get occurrences for loops with 'break'/'continue' statements

iifes like this are hard to read.  just make a normal function declaration and then call it on startPoint