stated with building the index function