This code was clearly meant to return _after_ the loop. Don't put the return inside the loop body, then.