better(?) tree compare impl