added compare with help from BinTree