the rest of the code will be simpler once it's decided startIdx is always size_t