some tidying of rbtree code mainly