add index and add function functionality