Add compare function and resource function