Now using std::distance for container sizes
Functions can now be used with for more iterators