finished loop algorithms