add restrict for come to index function, add test