iterateCount function added and called