Fixes for index handling.

* Fix so that if an update results in fewer indexed children, extra
indices will be removed.
* Add a hook to allow modified handling of index values, since the
default handling isn't appropriate for all cases.
* Includes tests.
(And so, this change is just padding out empty values to close that gap)