refactored to have the index name be defined.