Use exit rather than goto to break out of loop'