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.
Merge pull request #164 from nschoenholtz/fix-duplicate-indices

Fixes for index handling.