updates to code for setIndexDirect