Set Up comparison ui element and fixed an optimization bug in the comparison code.