collection algorithm