started attempt to use c++ index to speed up index based functions