Provide a general function for comparsion