Updating indices creating code