pass by reference when required, use size_t appropriately although that's going to change to iterators anyway