wrote index from scratch