Modifications to the compare function