Saving loop limit variable