Compare function.