Fix index rounding.

Rounding up was sometimes causing new indexes to clash with the finish index.  By rounding down instead we always know we are within the start<index<finish range.

factor some of the rename code into its own function to improve readability a bit.