Refactor Trees.deepEqual()