backported new rbtree implementation