Remove unnecessary indices.