Created a fix in indexSort method for repeat values. Still not executing
if statement properly.