Move a couple more functions to use iterators