Added compare function in ptype