removing nested structure