code cleanup of index