Created function to remove an index