Tweaking to prevent unneeded loops