create-index-change review changes

I've made a few changes after review and added a basic test. Please check if it is correct and working correctly.