Add comparison function and tests.