first implementation of index