refactor natrecursivecompare, add tests