Working comparison code