Added comparison functions and tests.