added logging for debugging purposes and delete segmens after they are indexed