finished comparison functions (not fully tested)