Help my SQL indexes

/*-*-*-*-*-*-*-*-* ﷽‎  *-*-*-*-*-*-*-*-*-*-*-*/
SET FMTONLY OFF;/*This is for temporary tables in SSRS, you never know if you want to use this in a report*/
SET NOCOUNT ON;
SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED;
SET STATISTICS IO ON
DECLARE @Database VARCHAR(255), @SpeedFactor INT, @isEnterprise INT, @rebuildonline VARCHAR(5),@MinForRebuild INT, @Table VARCHAR(255), @cmd NVARCHAR(3500),@cmd2 NVARCHAR(3500), @fillfactor INT, @pagemin INT, @fragmin INT, @WaitFor VARCHAR(12),@ActivateWait VARCHAR(1), @JustShowMe VARCHAR(1);

SET @WaitFor = '00:00:15';		/*hh:mm:ss Average time for a big index is around 2 minutes, and assume around 25% the trans log filled by each rebuild*/
SET @fillfactor = 70;			/*Depending or your index growth anywhere between 70-90 should work*/
SET @pagemin = 500;				/*not concerned with small tables, ignore less than 1500 pages index*/
SET @fragmin = 1;				/*Ignore fragmentation less than 5%*/
SET @ActivateWait = 0;			/*1 will active it*/
SET @JustShowMe = 1;			/*0 is off*/
SET @SpeedFactor = 17.5;		/* The estimated time factor.. change this to fine tune actual time rebuild will take*/
SET @MinForRebuild = 25;		/*Min fragmentation % for rebuild*/
SET @rebuildonline = 'OFF';		/*Assume this is not Enterprise, we will test in the next line and if it is , woohoo.*/
SELECT @isEnterprise = PATINDEX('%enterprise%',@@Version);
IF (@isEnterprise > 0)
BEGIN
	PRINT 'This is a Enterprise Server, we will use online rebuild' ;
	/*Can also use CAST(SERVERPROPERTY('EngineEdition') AS INT), thanks http://www.brentozar.com/ */
	SET @MinForRebuild = 15;	/*Lets lower our expectations for rebuilds, as we are splurging half our budget on the Enterprise License, so who cares*/
	SET @rebuildonline = 'ON';
END;

DECLARE @Databases TABLE
	(
	id INT IDENTITY(1,1)
	, databasename VARCHAR(250)
	, [compatibility_level] INT
	, user_access INT
	, user_access_desc VARCHAR(50)
	, [state] INT
	, state_desc  VARCHAR(50)
	, recovery_model INT
	, recovery_model_desc  VARCHAR(50)
	);

INSERT INTO @Databases
	SELECT
	db.name
	, db.compatibility_level
	, db.user_access
	, db.user_access_desc
	, db.state
	, db.state_desc
	, db.recovery_model
	, db.recovery_model_desc
	FROM
	sys.databases db
	WHERE name NOT IN ('master','msdb','tempdb','model','distribution') /*List of excluded Databases*/
	AND db.state <> 6 AND db.user_access <> 1

IF @JustShowMe = 0
BEGIN
	DECLARE @Outputme TABLE
		(
		id INT
		, type_desc VARCHAR(50)
		, database_id INT
		, object_id VARCHAR(250)
		, tablename VARCHAR(250)
		, index_id INT
		, name VARCHAR(250)
		, page_count INT
		, avg_fragmentation_in_percent DECIMAL(10,3)
		, PageSize_MB DECIMAL(10,3)
		, [Rows] BIGINT
		);
END;
DECLARE @i_Count INT, @i_Max INT
SET @i_Max = (SELECT MAX(id) FROM @Databases )
SET @i_Count = 1
WHILE @i_Count <= @i_Max
BEGIN
SET @Database = (SELECT databasename FROM @Databases WHERE id = @i_Count)
/*@cmd2 is the read only part of the code*/
SET @cmd2 = 'USE ['+@Database+']
	DECLARE @IndexStats TABLE(TableName VARCHAR(100), IndexName VARCHAR(100), IndexId TINYINT, [object_id] INT, [Rows] BIGINT, IndexSize_MB DECIMAL(10,3), TotalSize_MB DECIMAL(10,3))
	INSERT INTO @IndexStats
	SELECT
	OBJECT_NAME(i.OBJECT_ID) AS TableName
	, i.name AS IndexName
	, i.index_id AS IndexID
	, i.object_id
	, SUM(p.rows) [Rows]
	,8 * SUM(CONVERT(DECIMAL(10,3),a.used_pages))/1024 AS ''Indexsize(MB)''
	,8 * SUM(CONVERT(DECIMAL(10,3),a.total_pages))/1024 AS ''TotalSize(MB)''
	FROM sys.indexes AS i
	JOIN sy