Added first working compare function