cleaned up add() function by using new iterators