index cleaning code now handles "edge" cases (pun intended)