make index function