cleanup index and add cursor pointer to sidebar