Updated for the issue with highest loop count