add function from array to index