Commits

Benjamin Saller committed 97307c7

basic rbset object

builtin sets this still allows for custom cmp
function. This means that you can make rbsets behave as bags allowing
multiple equal values into the set but still quickly test for
membership

  • Participants
  • Parent commits 9bc268c

Comments (0)

Files changed (5)

-/* Generated by Pyrex 0.9.8.5 on Sun Apr 25 11:51:13 2010 */
+/* Generated by Pyrex 0.9.8.5 on Thu Apr 29 14:22:59 2010 */
 
 #define PY_SSIZE_T_CLEAN
 #include "Python.h"
 
 static char __pyx_mdoc[] = "\nrbtree\n~~~~~~~~~~~~~~~~~~~~\nan rbtree impl for python using pyrex\n\n";
 
+static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[],     Py_ssize_t nargs, PyObject **args2, PyObject **kwds2, char rqd_kwds[]); /*proto*/
+
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+
 static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/
 
 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
 
-static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
-
-static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[],     Py_ssize_t nargs, PyObject **args2, PyObject **kwds2, char rqd_kwds[]); /*proto*/
-
 static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/
 
 static PyObject *__Pyx_UnpackItem(PyObject *); /*proto*/
 
 /* Declarations from implementation of rbtree */
 
-struct __pyx_obj_6rbtree_rbtreeIterator {
+struct __pyx_obj_6rbtree_rbbase {
   PyObject_HEAD
-  struct __pyx_vtabstruct_6rbtree_rbtreeIterator *__pyx_vtab;
-  struct __pyx_obj_6rbtree_rbtree *_T;
+  struct __pyx_vtabstruct_6rbtree_rbbase *__pyx_vtab;
+  rbtree_t *_tree;
+};
+
+struct __pyx_obj_6rbtree_rb_iterator {
+  PyObject_HEAD
+  struct __pyx_vtabstruct_6rbtree_rb_iterator *__pyx_vtab;
+  struct __pyx_obj_6rbtree_rbbase *_T;
   rbtree_node_t *_iter;
   int _type;
   int _done;
 };
 
 struct __pyx_obj_6rbtree_rbtree {
-  PyObject_HEAD
-  rbtree_t *_tree;
+  struct __pyx_obj_6rbtree_rbbase __pyx_base;
 };
 
-
-
-struct __pyx_vtabstruct_6rbtree_rbtreeIterator {
-  PyObject *(*_position)(struct __pyx_obj_6rbtree_rbtreeIterator *,iter_direction);
-  rbtree_node_t *(*walk)(struct __pyx_obj_6rbtree_rbtreeIterator *,iter_direction);
-  PyObject *(*step)(struct __pyx_obj_6rbtree_rbtreeIterator *,iter_direction);
+struct __pyx_obj_6rbtree_rbset {
+  struct __pyx_obj_6rbtree_rbbase __pyx_base;
 };
-static struct __pyx_vtabstruct_6rbtree_rbtreeIterator *__pyx_vtabptr_6rbtree_rbtreeIterator;
-
+
+
+struct __pyx_vtabstruct_6rbtree_rbbase {
+  PyObject *(*empty_copy)(struct __pyx_obj_6rbtree_rbbase *);
+};
+static struct __pyx_vtabstruct_6rbtree_rbbase *__pyx_vtabptr_6rbtree_rbbase;
+
+
+struct __pyx_vtabstruct_6rbtree_rbtree {
+  struct __pyx_vtabstruct_6rbtree_rbbase __pyx_base;
+};
+static struct __pyx_vtabstruct_6rbtree_rbtree *__pyx_vtabptr_6rbtree_rbtree;
+
+
+struct __pyx_vtabstruct_6rbtree_rbset {
+  struct __pyx_vtabstruct_6rbtree_rbbase __pyx_base;
+};
+static struct __pyx_vtabstruct_6rbtree_rbset *__pyx_vtabptr_6rbtree_rbset;
+
+
+struct __pyx_vtabstruct_6rbtree_rb_iterator {
+  PyObject *(*_position)(struct __pyx_obj_6rbtree_rb_iterator *,iter_direction);
+  rbtree_node_t *(*walk)(struct __pyx_obj_6rbtree_rb_iterator *,iter_direction);
+  PyObject *(*step)(struct __pyx_obj_6rbtree_rb_iterator *,iter_direction);
+};
+static struct __pyx_vtabstruct_6rbtree_rb_iterator *__pyx_vtabptr_6rbtree_rb_iterator;
+
+static PyTypeObject *__pyx_ptype_6rbtree_rbbase = 0;
 static PyTypeObject *__pyx_ptype_6rbtree_rbtree = 0;
-static PyTypeObject *__pyx_ptype_6rbtree_rbtreeIterator = 0;
-
-static char __pyx_k1[] = "direction";
-static char __pyx_k2[] = "KEYS";
-static char __pyx_k3[] = "key";
-static char __pyx_k4[] = "VALUES";
-static char __pyx_k5[] = "value";
-static char __pyx_k6[] = "NODES";
-static char __pyx_k7[] = "item";
-static char __pyx_k8[] = "Iterator has no current value";
-static char __pyx_k9[] = "ITEMS";
-static char __pyx_k10[] = "update";
-static char __pyx_k11[] = "data";
-static char __pyx_k12[] = "compare";
-static char __pyx_k13[] = "Can only test equality of two rbtrees";
-static char __pyx_k14[] = "iternodes";
-static char __pyx_k15[] = "next";
-static char __pyx_k16[] = "setslice is unsupported";
-static char __pyx_k17[] = "__doslice__";
-static char __pyx_k18[] = "__dodeleteslice__";
-static char __pyx_k19[] = "__class__";
-static char __pyx_k20[] = "start";
-static char __pyx_k21[] = "stop";
-static char __pyx_k22[] = "step";
-static char __pyx_k23[] = "__iter__";
-static char __pyx_k24[] = "itervalues";
-static char __pyx_k25[] = "iteritems";
-static char __pyx_k26[] = "lists and tuples must be of the form [(k, v), ...]";
-static char __pyx_k27[] = "Unsupported type %s for update(need dict/sequence)";
-static char __pyx_k28[] = "append";
-static char __pyx_k29[] = "%r : %r";
-static char __pyx_k30[] = " ";
-static char __pyx_k31[] = ", ";
-static char __pyx_k32[] = "join";
-static char __pyx_k33[] = "";
-static char __pyx_k34[] = "<%s%s>";
-static char __pyx_k35[] = "__name__";
-static char __pyx_k36[] = "Benjamin Saller <bcsaller@gmail.com>";
-static char __pyx_k37[] = "__author__";
-static char __pyx_k38[] = "Benjamin Saller 2010";
-static char __pyx_k39[] = "__copyright__";
-static char __pyx_k40[] = "The GNU Public License 3";
-static char __pyx_k41[] = "__license__";
+static PyTypeObject *__pyx_ptype_6rbtree_rbset = 0;
+static PyTypeObject *__pyx_ptype_6rbtree_rb_iterator = 0;
+
+static char __pyx_k1[] = "compare";
+static char __pyx_k2[] = "update";
+static char __pyx_k3[] = "data";
+static char __pyx_k4[] = "KEYS";
+static char __pyx_k5[] = "direction";
+static char __pyx_k6[] = "__class__";
+static char __pyx_k7[] = "cmp";
+static char __pyx_k8[] = "key";
+static char __pyx_k9[] = "VALUES";
+static char __pyx_k10[] = "value";
+static char __pyx_k11[] = "NODES";
+static char __pyx_k12[] = "item";
+static char __pyx_k13[] = "Iterator has no current value";
+static char __pyx_k14[] = "ITEMS";
+static char __pyx_k15[] = "Can only test equality of two %s";
+static char __pyx_k16[] = "__name__";
+static char __pyx_k17[] = "iternodes";
+static char __pyx_k18[] = "next";
+static char __pyx_k19[] = "setslice is unsupported";
+static char __pyx_k20[] = "__doslice__";
+static char __pyx_k21[] = "__dodeleteslice__";
+static char __pyx_k22[] = "start";
+static char __pyx_k23[] = "stop";
+static char __pyx_k24[] = "step";
+static char __pyx_k25[] = "__iter__";
+static char __pyx_k26[] = "itervalues";
+static char __pyx_k27[] = "iteritems";
+static char __pyx_k28[] = "lists and tuples must be of the form [(k, v), ...]";
+static char __pyx_k29[] = "Unsupported type %s for update(need dict/sequence)";
+static char __pyx_k30[] = "append";
+static char __pyx_k31[] = "(%r,  %r)";
+static char __pyx_k32[] = " ";
+static char __pyx_k33[] = ", ";
+static char __pyx_k34[] = "join";
+static char __pyx_k35[] = "";
+static char __pyx_k36[] = "[%s]";
+static char __pyx_k37[] = "Can only test equality of two rbset";
+static char __pyx_k38[] = "symmetric_difference";
+static char __pyx_k39[] = "add";
+static char __pyx_k40[] = "intersection";
+static char __pyx_k41[] = "difference";
+static char __pyx_k42[] = "union";
+static char __pyx_k43[] = "discard";
+static char __pyx_k44[] = "difference_update";
+static char __pyx_k45[] = "intersection_update";
+static char __pyx_k46[] = "Benjamin Saller <bcsaller@gmail.com>";
+static char __pyx_k47[] = "__author__";
+static char __pyx_k48[] = "Benjamin Saller 2010";
+static char __pyx_k49[] = "__copyright__";
+static char __pyx_k50[] = "The GNU Public License 3";
+static char __pyx_k51[] = "__license__";
 
 static PyObject *__pyx_n_ITEMS;
 static PyObject *__pyx_n_KEYS;
 static PyObject *__pyx_n___iter__;
 static PyObject *__pyx_n___license__;
 static PyObject *__pyx_n___name__;
+static PyObject *__pyx_n_add;
 static PyObject *__pyx_n_append;
+static PyObject *__pyx_n_cmp;
 static PyObject *__pyx_n_compare;
 static PyObject *__pyx_n_data;
+static PyObject *__pyx_n_difference;
+static PyObject *__pyx_n_difference_update;
 static PyObject *__pyx_n_direction;
+static PyObject *__pyx_n_discard;
+static PyObject *__pyx_n_intersection;
+static PyObject *__pyx_n_intersection_update;
 static PyObject *__pyx_n_item;
 static PyObject *__pyx_n_iteritems;
 static PyObject *__pyx_n_iternodes;
 static PyObject *__pyx_n_start;
 static PyObject *__pyx_n_step;
 static PyObject *__pyx_n_stop;
+static PyObject *__pyx_n_symmetric_difference;
+static PyObject *__pyx_n_union;
 static PyObject *__pyx_n_update;
 static PyObject *__pyx_n_value;
 
-static PyObject *__pyx_k8p;
 static PyObject *__pyx_k13p;
-static PyObject *__pyx_k16p;
-static PyObject *__pyx_k26p;
-static PyObject *__pyx_k27p;
+static PyObject *__pyx_k15p;
+static PyObject *__pyx_k19p;
+static PyObject *__pyx_k28p;
 static PyObject *__pyx_k29p;
-static PyObject *__pyx_k30p;
 static PyObject *__pyx_k31p;
+static PyObject *__pyx_k32p;
 static PyObject *__pyx_k33p;
-static PyObject *__pyx_k34p;
+static PyObject *__pyx_k35p;
 static PyObject *__pyx_k36p;
-static PyObject *__pyx_k38p;
-static PyObject *__pyx_k40p;
+static PyObject *__pyx_k37p;
+static PyObject *__pyx_k46p;
+static PyObject *__pyx_k48p;
+static PyObject *__pyx_k50p;
 
 static __Pyx_StringTabEntry __pyx_string_tab[] = {
-  {&__pyx_n_ITEMS, 1, __pyx_k9, sizeof(__pyx_k9)},
-  {&__pyx_n_KEYS, 1, __pyx_k2, sizeof(__pyx_k2)},
-  {&__pyx_n_NODES, 1, __pyx_k6, sizeof(__pyx_k6)},
-  {&__pyx_n_VALUES, 1, __pyx_k4, sizeof(__pyx_k4)},
-  {&__pyx_n___author__, 1, __pyx_k37, sizeof(__pyx_k37)},
-  {&__pyx_n___class__, 1, __pyx_k19, sizeof(__pyx_k19)},
-  {&__pyx_n___copyright__, 1, __pyx_k39, sizeof(__pyx_k39)},
-  {&__pyx_n___dodeleteslice__, 1, __pyx_k18, sizeof(__pyx_k18)},
-  {&__pyx_n___doslice__, 1, __pyx_k17, sizeof(__pyx_k17)},
-  {&__pyx_n___iter__, 1, __pyx_k23, sizeof(__pyx_k23)},
-  {&__pyx_n___license__, 1, __pyx_k41, sizeof(__pyx_k41)},
-  {&__pyx_n___name__, 1, __pyx_k35, sizeof(__pyx_k35)},
-  {&__pyx_n_append, 1, __pyx_k28, sizeof(__pyx_k28)},
-  {&__pyx_n_compare, 1, __pyx_k12, sizeof(__pyx_k12)},
-  {&__pyx_n_data, 1, __pyx_k11, sizeof(__pyx_k11)},
-  {&__pyx_n_direction, 1, __pyx_k1, sizeof(__pyx_k1)},
-  {&__pyx_n_item, 1, __pyx_k7, sizeof(__pyx_k7)},
-  {&__pyx_n_iteritems, 1, __pyx_k25, sizeof(__pyx_k25)},
-  {&__pyx_n_iternodes, 1, __pyx_k14, sizeof(__pyx_k14)},
-  {&__pyx_n_itervalues, 1, __pyx_k24, sizeof(__pyx_k24)},
-  {&__pyx_n_join, 1, __pyx_k32, sizeof(__pyx_k32)},
-  {&__pyx_n_key, 1, __pyx_k3, sizeof(__pyx_k3)},
-  {&__pyx_n_next, 1, __pyx_k15, sizeof(__pyx_k15)},
-  {&__pyx_n_start, 1, __pyx_k20, sizeof(__pyx_k20)},
-  {&__pyx_n_step, 1, __pyx_k22, sizeof(__pyx_k22)},
-  {&__pyx_n_stop, 1, __pyx_k21, sizeof(__pyx_k21)},
-  {&__pyx_n_update, 1, __pyx_k10, sizeof(__pyx_k10)},
-  {&__pyx_n_value, 1, __pyx_k5, sizeof(__pyx_k5)},
-  {&__pyx_k8p, 0, __pyx_k8, sizeof(__pyx_k8)},
+  {&__pyx_n_ITEMS, 1, __pyx_k14, sizeof(__pyx_k14)},
+  {&__pyx_n_KEYS, 1, __pyx_k4, sizeof(__pyx_k4)},
+  {&__pyx_n_NODES, 1, __pyx_k11, sizeof(__pyx_k11)},
+  {&__pyx_n_VALUES, 1, __pyx_k9, sizeof(__pyx_k9)},
+  {&__pyx_n___author__, 1, __pyx_k47, sizeof(__pyx_k47)},
+  {&__pyx_n___class__, 1, __pyx_k6, sizeof(__pyx_k6)},
+  {&__pyx_n___copyright__, 1, __pyx_k49, sizeof(__pyx_k49)},
+  {&__pyx_n___dodeleteslice__, 1, __pyx_k21, sizeof(__pyx_k21)},
+  {&__pyx_n___doslice__, 1, __pyx_k20, sizeof(__pyx_k20)},
+  {&__pyx_n___iter__, 1, __pyx_k25, sizeof(__pyx_k25)},
+  {&__pyx_n___license__, 1, __pyx_k51, sizeof(__pyx_k51)},
+  {&__pyx_n___name__, 1, __pyx_k16, sizeof(__pyx_k16)},
+  {&__pyx_n_add, 1, __pyx_k39, sizeof(__pyx_k39)},
+  {&__pyx_n_append, 1, __pyx_k30, sizeof(__pyx_k30)},
+  {&__pyx_n_cmp, 1, __pyx_k7, sizeof(__pyx_k7)},
+  {&__pyx_n_compare, 1, __pyx_k1, sizeof(__pyx_k1)},
+  {&__pyx_n_data, 1, __pyx_k3, sizeof(__pyx_k3)},
+  {&__pyx_n_difference, 1, __pyx_k41, sizeof(__pyx_k41)},
+  {&__pyx_n_difference_update, 1, __pyx_k44, sizeof(__pyx_k44)},
+  {&__pyx_n_direction, 1, __pyx_k5, sizeof(__pyx_k5)},
+  {&__pyx_n_discard, 1, __pyx_k43, sizeof(__pyx_k43)},
+  {&__pyx_n_intersection, 1, __pyx_k40, sizeof(__pyx_k40)},
+  {&__pyx_n_intersection_update, 1, __pyx_k45, sizeof(__pyx_k45)},
+  {&__pyx_n_item, 1, __pyx_k12, sizeof(__pyx_k12)},
+  {&__pyx_n_iteritems, 1, __pyx_k27, sizeof(__pyx_k27)},
+  {&__pyx_n_iternodes, 1, __pyx_k17, sizeof(__pyx_k17)},
+  {&__pyx_n_itervalues, 1, __pyx_k26, sizeof(__pyx_k26)},
+  {&__pyx_n_join, 1, __pyx_k34, sizeof(__pyx_k34)},
+  {&__pyx_n_key, 1, __pyx_k8, sizeof(__pyx_k8)},
+  {&__pyx_n_next, 1, __pyx_k18, sizeof(__pyx_k18)},
+  {&__pyx_n_start, 1, __pyx_k22, sizeof(__pyx_k22)},
+  {&__pyx_n_step, 1, __pyx_k24, sizeof(__pyx_k24)},
+  {&__pyx_n_stop, 1, __pyx_k23, sizeof(__pyx_k23)},
+  {&__pyx_n_symmetric_difference, 1, __pyx_k38, sizeof(__pyx_k38)},
+  {&__pyx_n_union, 1, __pyx_k42, sizeof(__pyx_k42)},
+  {&__pyx_n_update, 1, __pyx_k2, sizeof(__pyx_k2)},
+  {&__pyx_n_value, 1, __pyx_k10, sizeof(__pyx_k10)},
   {&__pyx_k13p, 0, __pyx_k13, sizeof(__pyx_k13)},
-  {&__pyx_k16p, 0, __pyx_k16, sizeof(__pyx_k16)},
-  {&__pyx_k26p, 0, __pyx_k26, sizeof(__pyx_k26)},
-  {&__pyx_k27p, 0, __pyx_k27, sizeof(__pyx_k27)},
+  {&__pyx_k15p, 0, __pyx_k15, sizeof(__pyx_k15)},
+  {&__pyx_k19p, 0, __pyx_k19, sizeof(__pyx_k19)},
+  {&__pyx_k28p, 0, __pyx_k28, sizeof(__pyx_k28)},
   {&__pyx_k29p, 0, __pyx_k29, sizeof(__pyx_k29)},
-  {&__pyx_k30p, 0, __pyx_k30, sizeof(__pyx_k30)},
   {&__pyx_k31p, 0, __pyx_k31, sizeof(__pyx_k31)},
+  {&__pyx_k32p, 0, __pyx_k32, sizeof(__pyx_k32)},
   {&__pyx_k33p, 0, __pyx_k33, sizeof(__pyx_k33)},
-  {&__pyx_k34p, 0, __pyx_k34, sizeof(__pyx_k34)},
+  {&__pyx_k35p, 0, __pyx_k35, sizeof(__pyx_k35)},
   {&__pyx_k36p, 0, __pyx_k36, sizeof(__pyx_k36)},
-  {&__pyx_k38p, 0, __pyx_k38, sizeof(__pyx_k38)},
-  {&__pyx_k40p, 0, __pyx_k40, sizeof(__pyx_k40)},
+  {&__pyx_k37p, 0, __pyx_k37, sizeof(__pyx_k37)},
+  {&__pyx_k46p, 0, __pyx_k46, sizeof(__pyx_k46)},
+  {&__pyx_k48p, 0, __pyx_k48, sizeof(__pyx_k48)},
+  {&__pyx_k50p, 0, __pyx_k50, sizeof(__pyx_k50)},
   {0, 0, 0, 0}
 };
 
 static PyObject *__pyx_d2;
 static PyObject *__pyx_d3;
 static PyObject *__pyx_d4;
+static PyObject *__pyx_d5;
+static PyObject *__pyx_d6;
 
 
 /* Implementation of rbtree */
 
-static int __pyx_f_6rbtree_14rbtreeIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static int __pyx_f_6rbtree_14rbtreeIterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  struct __pyx_obj_6rbtree_rbtree *__pyx_v_tree = 0;
+static void __pyx_f_6rbtree_6rbbase___dealloc__(PyObject *__pyx_v_self); /*proto*/
+static void __pyx_f_6rbtree_6rbbase___dealloc__(PyObject *__pyx_v_self) {
+  Py_INCREF(__pyx_v_self);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":82 */
+  rbtree_dealloc(((struct __pyx_obj_6rbtree_rbbase *)__pyx_v_self)->_tree);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":83 */
+  rbtree_free(((struct __pyx_obj_6rbtree_rbbase *)__pyx_v_self)->_tree);
+
+  Py_DECREF(__pyx_v_self);
+}
+
+static PyObject *__pyx_f_6rbtree_6rbbase___getnewargs__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_6rbtree_6rbbase___getnewargs__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_args = 0;
+  PyObject *__pyx_r;
+  PyObject *__pyx_1 = 0;
+  static char *__pyx_argnames[] = {0};
+  if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, 0, 0) < 0) return 0;
+  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) {
+    Py_XDECREF(__pyx_args);
+    Py_XDECREF(__pyx_kwds);
+    Py_XDECREF(__pyx_v_args);
+    return 0;
+  }
+  Py_INCREF(__pyx_v_self);
+  __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L1;}
+  __pyx_r = __pyx_1;
+  __pyx_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  Py_XDECREF(__pyx_1);
+  __Pyx_AddTraceback("rbtree.rbbase.__getnewargs__");
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_XDECREF(__pyx_v_args);
+  Py_DECREF(__pyx_v_self);
+  Py_XDECREF(__pyx_args);
+  Py_XDECREF(__pyx_kwds);
+  return __pyx_r;
+}
+
+static PyObject *__pyx_f_6rbtree_6rbbase___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_6rbtree_6rbbase___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_state = 0;
+  PyObject *__pyx_r;
+  PyObject *__pyx_1 = 0;
+  int __pyx_2;
+  PyObject *__pyx_3 = 0;
+  PyObject *__pyx_4 = 0;
+  static char *__pyx_argnames[] = {"state",0};
+  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_state)) return 0;
+  Py_INCREF(__pyx_v_self);
+  Py_INCREF(__pyx_v_state);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":92 */
+  __pyx_1 = PyObject_GetItem(__pyx_v_state, __pyx_n_compare); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+  __pyx_2 = __pyx_1 != Py_None;
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  if (__pyx_2) {
+    __pyx_1 = PyObject_GetItem(__pyx_v_state, __pyx_n_compare); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
+    rbtree_set_compare(((struct __pyx_obj_6rbtree_rbbase *)__pyx_v_self)->_tree,__pyx_1);
+    Py_DECREF(__pyx_1); __pyx_1 = 0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":95 */
+  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_update); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetItem(__pyx_v_state, __pyx_n_data); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
+  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
+  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
+  __pyx_3 = 0;
+  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; goto __pyx_L1;}
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  Py_XDECREF(__pyx_1);
+  Py_XDECREF(__pyx_3);
+  Py_XDECREF(__pyx_4);
+  __Pyx_AddTraceback("rbtree.rbbase.__setstate__");
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(__pyx_v_self);
+  Py_DECREF(__pyx_v_state);
+  return __pyx_r;
+}
+
+static Py_ssize_t __pyx_f_6rbtree_6rbbase___len__(PyObject *__pyx_v_self); /*proto*/
+static Py_ssize_t __pyx_f_6rbtree_6rbbase___len__(PyObject *__pyx_v_self) {
+  Py_ssize_t __pyx_r;
+  Py_INCREF(__pyx_v_self);
+  __pyx_r = ((struct __pyx_obj_6rbtree_rbbase *)__pyx_v_self)->_tree->ct;
+  goto __pyx_L0;
+
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(__pyx_v_self);
+  return __pyx_r;
+}
+
+static int __pyx_f_6rbtree_6rbbase___contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key); /*proto*/
+static int __pyx_f_6rbtree_6rbbase___contains__(PyObject *__pyx_v_self, PyObject *__pyx_v_key) {
+  void *__pyx_v_v;
+  int __pyx_r;
+  Py_INCREF(__pyx_v_self);
+  Py_INCREF(__pyx_v_key);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":103 */
+  __pyx_v_v = rbtree_get(((struct __pyx_obj_6rbtree_rbbase *)__pyx_v_self)->_tree,__pyx_v_key);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":104 */
+  __pyx_r = (__pyx_v_v != NULL);
+  goto __pyx_L0;
+
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(__pyx_v_self);
+  Py_DECREF(__pyx_v_key);
+  return __pyx_r;
+}
+
+static PyObject *__pyx_f_6rbtree_6rbbase_has_key(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_6rbtree_6rbbase_has_key(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_key = 0;
+  PyObject *__pyx_r;
+  int __pyx_1;
+  PyObject *__pyx_2 = 0;
+  static char *__pyx_argnames[] = {"key",0};
+  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_key)) return 0;
+  Py_INCREF(__pyx_v_self);
+  Py_INCREF(__pyx_v_key);
+  __pyx_1 = PySequence_Contains(__pyx_v_self, __pyx_v_key); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
+  __pyx_2 = PyInt_FromLong(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; goto __pyx_L1;}
+  __pyx_r = __pyx_2;
+  __pyx_2 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  Py_XDECREF(__pyx_2);
+  __Pyx_AddTraceback("rbtree.rbbase.has_key");
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(__pyx_v_self);
+  Py_DECREF(__pyx_v_key);
+  return __pyx_r;
+}
+
+static PyObject *__pyx_f_6rbtree_6rbbase___iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_f_6rbtree_6rbbase___iter__(PyObject *__pyx_v_self) {
+  PyObject *__pyx_r;
+  PyObject *__pyx_1 = 0;
+  PyObject *__pyx_2 = 0;
+  Py_INCREF(__pyx_v_self);
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_KEYS); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
+  Py_INCREF(__pyx_v_self);
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self);
+  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_1);
+  __pyx_1 = 0;
+  __pyx_1 = PyObject_CallObject(((PyObject *)__pyx_ptype_6rbtree_rb_iterator), __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  __pyx_r = __pyx_1;
+  __pyx_1 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  Py_XDECREF(__pyx_1);
+  Py_XDECREF(__pyx_2);
+  __Pyx_AddTraceback("rbtree.rbbase.__iter__");
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(__pyx_v_self);
+  return __pyx_r;
+}
+
+static PyObject *__pyx_f_6rbtree_6rbbase___reversed__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_6rbtree_6rbbase___reversed__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_i;
+  PyObject *__pyx_r;
+  PyObject *__pyx_1 = 0;
+  PyObject *__pyx_2 = 0;
+  static char *__pyx_argnames[] = {0};
+  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
+  Py_INCREF(__pyx_v_self);
+  __pyx_v_i = Py_None; Py_INCREF(Py_None);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":114 */
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_KEYS); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
+  Py_INCREF(__pyx_v_self);
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self);
+  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_1);
+  __pyx_1 = 0;
+  __pyx_1 = PyObject_CallObject(((PyObject *)__pyx_ptype_6rbtree_rb_iterator), __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  Py_DECREF(__pyx_v_i);
+  __pyx_v_i = __pyx_1;
+  __pyx_1 = 0;
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":115 */
+  __pyx_2 = PyInt_FromLong(BACKWARD); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_v_i, __pyx_n_direction, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":116 */
+  Py_INCREF(__pyx_v_i);
+  __pyx_r = __pyx_v_i;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  Py_XDECREF(__pyx_1);
+  Py_XDECREF(__pyx_2);
+  __Pyx_AddTraceback("rbtree.rbbase.__reversed__");
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(__pyx_v_i);
+  Py_DECREF(__pyx_v_self);
+  return __pyx_r;
+}
+
+static PyObject *__pyx_f_6rbtree_6rbbase_copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_6rbtree_6rbbase_copy(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_r;
+  PyObject *__pyx_1 = 0;
+  PyObject *__pyx_2 = 0;
+  PyObject *__pyx_3 = 0;
+  PyObject *__pyx_4 = 0;
+  static char *__pyx_argnames[] = {0};
+  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
+  Py_INCREF(__pyx_v_self);
+  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
+  Py_INCREF(__pyx_v_self);
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self);
+  __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
+  __pyx_4 = rbtree_get_compare(((struct __pyx_obj_6rbtree_rbbase *)__pyx_v_self)->_tree); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
+  if (PyDict_SetItem(__pyx_3, __pyx_n_cmp, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_r = __pyx_4;
+  __pyx_4 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  Py_XDECREF(__pyx_1);
+  Py_XDECREF(__pyx_2);
+  Py_XDECREF(__pyx_3);
+  Py_XDECREF(__pyx_4);
+  __Pyx_AddTraceback("rbtree.rbbase.copy");
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(__pyx_v_self);
+  return __pyx_r;
+}
+
+static PyObject *__pyx_f_6rbtree_6rbbase_empty_copy(struct __pyx_obj_6rbtree_rbbase *__pyx_v_self) {
+  PyObject *__pyx_r;
+  PyObject *__pyx_1 = 0;
+  PyObject *__pyx_2 = 0;
+  PyObject *__pyx_3 = 0;
+  PyObject *__pyx_4 = 0;
+  Py_INCREF(__pyx_v_self);
+  __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n___class__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
+  __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
+  __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
+  __pyx_4 = rbtree_get_compare(__pyx_v_self->_tree); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
+  if (PyDict_SetItem(__pyx_3, __pyx_n_cmp, __pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
+  __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, __pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  Py_DECREF(__pyx_2); __pyx_2 = 0;
+  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  __pyx_r = __pyx_4;
+  __pyx_4 = 0;
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  Py_XDECREF(__pyx_1);
+  Py_XDECREF(__pyx_2);
+  Py_XDECREF(__pyx_3);
+  Py_XDECREF(__pyx_4);
+  __Pyx_AddTraceback("rbtree.rbbase.empty_copy");
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(__pyx_v_self);
+  return __pyx_r;
+}
+
+static PyObject *__pyx_f_6rbtree_6rbbase_clear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_6rbtree_6rbbase_clear(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_r;
+  static char *__pyx_argnames[] = {0};
+  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
+  Py_INCREF(__pyx_v_self);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":126 */
+  rbtree_dealloc(((struct __pyx_obj_6rbtree_rbbase *)__pyx_v_self)->_tree);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":127 */
+  rbtree_free(((struct __pyx_obj_6rbtree_rbbase *)__pyx_v_self)->_tree);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":128 */
+  ((struct __pyx_obj_6rbtree_rbbase *)__pyx_v_self)->_tree = rbtree_alloc();
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":129 */
+  rbtree_init(((struct __pyx_obj_6rbtree_rbbase *)__pyx_v_self)->_tree);
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  Py_DECREF(__pyx_v_self);
+  return __pyx_r;
+}
+
+static PyObject *__pyx_f_6rbtree_6rbbase_min(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_6rbtree_6rbbase_min(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_r;
+  Py_ssize_t __pyx_1;
+  int __pyx_2;
+  static char *__pyx_argnames[] = {0};
+  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
+  Py_INCREF(__pyx_v_self);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":133 */
+  __pyx_1 = PyObject_Length(__pyx_v_self); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
+  __pyx_2 = (__pyx_1 == 0);
+  if (__pyx_2) {
+    Py_INCREF(Py_None);
+    __pyx_r = Py_None;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":135 */
+  Py_INCREF(((PyObject *)tree_min(((struct __pyx_obj_6rbtree_rbbase *)__pyx_v_self)->_tree,NULL)->key));
+  __pyx_r = ((PyObject *)tree_min(((struct __pyx_obj_6rbtree_rbbase *)__pyx_v_self)->_tree,NULL)->key);
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  __Pyx_AddTraceback("rbtree.rbbase.min");
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(__pyx_v_self);
+  return __pyx_r;
+}
+
+static PyObject *__pyx_f_6rbtree_6rbbase_max(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_6rbtree_6rbbase_max(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_r;
+  Py_ssize_t __pyx_1;
+  int __pyx_2;
+  static char *__pyx_argnames[] = {0};
+  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
+  Py_INCREF(__pyx_v_self);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":139 */
+  __pyx_1 = PyObject_Length(__pyx_v_self); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; goto __pyx_L1;}
+  __pyx_2 = (__pyx_1 == 0);
+  if (__pyx_2) {
+    Py_INCREF(Py_None);
+    __pyx_r = Py_None;
+    goto __pyx_L0;
+    goto __pyx_L2;
+  }
+  __pyx_L2:;
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":141 */
+  Py_INCREF(((PyObject *)tree_max(((struct __pyx_obj_6rbtree_rbbase *)__pyx_v_self)->_tree,NULL)->key));
+  __pyx_r = ((PyObject *)tree_max(((struct __pyx_obj_6rbtree_rbbase *)__pyx_v_self)->_tree,NULL)->key);
+  goto __pyx_L0;
+
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  __Pyx_AddTraceback("rbtree.rbbase.max");
+  __pyx_r = 0;
+  __pyx_L0:;
+  Py_DECREF(__pyx_v_self);
+  return __pyx_r;
+}
+
+static int __pyx_f_6rbtree_11rb_iterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_f_6rbtree_11rb_iterator___cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  struct __pyx_obj_6rbtree_rbbase *__pyx_v_tree = 0;
   int __pyx_v_itype;
   int __pyx_r;
   int __pyx_1;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "Oi", __pyx_argnames, &__pyx_v_tree, &__pyx_v_itype)) return -1;
   Py_INCREF(__pyx_v_self);
   Py_INCREF(__pyx_v_tree);
-  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tree), __pyx_ptype_6rbtree_rbtree, 1, "tree")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":83 */
+  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_tree), __pyx_ptype_6rbtree_rbbase, 1, "tree")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":152 */
   Py_INCREF(((PyObject *)__pyx_v_tree));
-  Py_DECREF(((PyObject *)((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_T));
-  ((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_T = __pyx_v_tree;
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":84 */
-  ((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter = NULL;
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":85 */
-  ((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_type = __pyx_v_itype;
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":86 */
-  __pyx_1 = PyInt_AsLong(Py_False); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
-  ((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_done = __pyx_1;
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":87 */
-  __pyx_2 = PyInt_FromLong(FORWARD); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L1;}
-  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_direction, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L1;}
+  Py_DECREF(((PyObject *)((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_T));
+  ((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_T = __pyx_v_tree;
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":153 */
+  ((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter = NULL;
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":154 */
+  ((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_type = __pyx_v_itype;
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":155 */
+  __pyx_1 = PyInt_AsLong(Py_False); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; goto __pyx_L1;}
+  ((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_done = __pyx_1;
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":156 */
+  __pyx_2 = PyInt_FromLong(FORWARD); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
+  if (PyObject_SetAttr(__pyx_v_self, __pyx_n_direction, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1:;
   Py_XDECREF(__pyx_2);
-  __Pyx_AddTraceback("rbtree.rbtreeIterator.__cinit__");
+  __Pyx_AddTraceback("rbtree.rb_iterator.__cinit__");
   __pyx_r = -1;
   __pyx_L0:;
   Py_DECREF(__pyx_v_self);
   return __pyx_r;
 }
 
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_9direction___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_9direction___get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_f_6rbtree_11rb_iterator_9direction___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_f_6rbtree_11rb_iterator_9direction___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r;
   PyObject *__pyx_1 = 0;
   Py_INCREF(__pyx_v_self);
-  __pyx_1 = PyInt_FromLong(((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_direction); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+  __pyx_1 = PyInt_FromLong(((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_direction); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}
   __pyx_r = __pyx_1;
   __pyx_1 = 0;
   goto __pyx_L0;
   goto __pyx_L0;
   __pyx_L1:;
   Py_XDECREF(__pyx_1);
-  __Pyx_AddTraceback("rbtree.rbtreeIterator.direction.__get__");
+  __Pyx_AddTraceback("rbtree.rb_iterator.direction.__get__");
   __pyx_r = 0;
   __pyx_L0:;
   Py_DECREF(__pyx_v_self);
   return __pyx_r;
 }
 
-static int __pyx_f_6rbtree_14rbtreeIterator_9direction___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
-static int __pyx_f_6rbtree_14rbtreeIterator_9direction___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
+static int __pyx_f_6rbtree_11rb_iterator_9direction___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/
+static int __pyx_f_6rbtree_11rb_iterator_9direction___set__(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) {
   int __pyx_v_value;
   int __pyx_r;
   Py_INCREF(__pyx_v_self);
-  __pyx_v_value = PyInt_AsLong(__pyx_arg_value); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
-  ((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_direction = ((iter_direction)__pyx_v_value);
+  __pyx_v_value = PyInt_AsLong(__pyx_arg_value); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; goto __pyx_L1;}
+  ((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_direction = ((iter_direction)__pyx_v_value);
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1:;
-  __Pyx_AddTraceback("rbtree.rbtreeIterator.direction.__set__");
+  __Pyx_AddTraceback("rbtree.rb_iterator.direction.__set__");
   __pyx_r = -1;
   __pyx_L0:;
   Py_DECREF(__pyx_v_self);
   return __pyx_r;
 }
 
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator__position(struct __pyx_obj_6rbtree_rbtreeIterator *__pyx_v_self,iter_direction __pyx_v_direction) {
+static PyObject *__pyx_f_6rbtree_11rb_iterator__position(struct __pyx_obj_6rbtree_rb_iterator *__pyx_v_self,iter_direction __pyx_v_direction) {
   PyObject *__pyx_r;
   int __pyx_1;
   Py_INCREF(__pyx_v_self);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":97 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":165 */
   __pyx_1 = __pyx_v_self->_done;
   if (__pyx_1) {
     __Pyx_Raise(PyExc_StopIteration, 0, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":100 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":168 */
   __pyx_1 = (__pyx_v_direction == FORWARD);
   if (__pyx_1) {
     __pyx_v_self->_iter = tree_min(__pyx_v_self->_T->_tree,NULL);
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  __Pyx_AddTraceback("rbtree.rbtreeIterator._position");
+  __Pyx_AddTraceback("rbtree.rb_iterator._position");
   __pyx_r = 0;
   __pyx_L0:;
   Py_DECREF(__pyx_v_self);
   return __pyx_r;
 }
 
-static rbtree_node_t *__pyx_f_6rbtree_14rbtreeIterator_walk(struct __pyx_obj_6rbtree_rbtreeIterator *__pyx_v_self,iter_direction __pyx_v_direction) {
+static rbtree_node_t *__pyx_f_6rbtree_11rb_iterator_walk(struct __pyx_obj_6rbtree_rb_iterator *__pyx_v_self,iter_direction __pyx_v_direction) {
   rbtree_node_t *__pyx_v_n;
   rbtree_node_t *__pyx_r;
   int __pyx_1;
   Py_INCREF(__pyx_v_self);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":107 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":175 */
   __pyx_1 = (__pyx_v_direction == FORWARD);
   if (__pyx_1) {
     __pyx_v_n = tree_successor(__pyx_v_self->_T->_tree,__pyx_v_self->_iter);
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":111 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":179 */
   __pyx_r = __pyx_v_n;
   goto __pyx_L0;
 
   return __pyx_r;
 }
 
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator___iter__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator___iter__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_f_6rbtree_11rb_iterator___iter__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_f_6rbtree_11rb_iterator___iter__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r;
   Py_INCREF(__pyx_v_self);
   Py_INCREF(__pyx_v_self);
   return __pyx_r;
 }
 
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_step(struct __pyx_obj_6rbtree_rbtreeIterator *__pyx_v_self,iter_direction __pyx_v_direction) {
+static PyObject *__pyx_f_6rbtree_11rb_iterator_step(struct __pyx_obj_6rbtree_rb_iterator *__pyx_v_self,iter_direction __pyx_v_direction) {
   PyObject *__pyx_v_r;
   PyObject *__pyx_r;
   int __pyx_1;
   Py_INCREF(__pyx_v_self);
   __pyx_v_r = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":119 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":186 */
   __pyx_1 = (__pyx_v_self->_iter == NULL);
   if (__pyx_1) {
-    __pyx_2 = ((struct __pyx_vtabstruct_6rbtree_rbtreeIterator *)__pyx_v_self->__pyx_vtab)->_position(__pyx_v_self,__pyx_v_direction); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; goto __pyx_L1;}
+    __pyx_2 = ((struct __pyx_vtabstruct_6rbtree_rb_iterator *)__pyx_v_self->__pyx_vtab)->_position(__pyx_v_self,__pyx_v_direction); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     goto __pyx_L2;
   }
   /*else*/ {
-    __pyx_v_self->_iter = ((struct __pyx_vtabstruct_6rbtree_rbtreeIterator *)__pyx_v_self->__pyx_vtab)->walk(__pyx_v_self,__pyx_v_direction);
+    __pyx_v_self->_iter = ((struct __pyx_vtabstruct_6rbtree_rb_iterator *)__pyx_v_self->__pyx_vtab)->walk(__pyx_v_self,__pyx_v_direction);
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":122 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":189 */
   __pyx_1 = (__pyx_v_self->_iter == NULL);
   if (__pyx_1) {
 
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":123 */
-    __pyx_1 = PyInt_AsLong(Py_True); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":190 */
+    __pyx_1 = PyInt_AsLong(Py_True); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; goto __pyx_L1;}
     __pyx_v_self->_done = __pyx_1;
 
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":124 */
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":191 */
     __Pyx_Raise(PyExc_StopIteration, 0, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; goto __pyx_L1;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":126 */
-  __pyx_2 = PyInt_FromLong(__pyx_v_self->_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
-  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_KEYS); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
-  if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":193 */
+  __pyx_2 = PyInt_FromLong(__pyx_v_self->_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_KEYS); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
+  if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
   __pyx_1 = __pyx_1 == 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   if (__pyx_1) {
-    __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_key); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
+    __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_key); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; goto __pyx_L1;}
     Py_DECREF(__pyx_v_r);
     __pyx_v_r = __pyx_2;
     __pyx_2 = 0;
     goto __pyx_L4;
   }
-  __pyx_3 = PyInt_FromLong(__pyx_v_self->_type); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
-  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_VALUES); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
-  if (PyObject_Cmp(__pyx_3, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
+  __pyx_3 = PyInt_FromLong(__pyx_v_self->_type); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
+  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_VALUES); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
+  if (PyObject_Cmp(__pyx_3, __pyx_2, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
   __pyx_1 = __pyx_1 == 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   if (__pyx_1) {
-    __pyx_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_value); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
+    __pyx_3 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_value); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; goto __pyx_L1;}
     Py_DECREF(__pyx_v_r);
     __pyx_v_r = __pyx_3;
     __pyx_3 = 0;
     goto __pyx_L4;
   }
-  __pyx_2 = PyInt_FromLong(__pyx_v_self->_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; goto __pyx_L1;}
-  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_NODES); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; goto __pyx_L1;}
-  if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; goto __pyx_L1;}
+  __pyx_2 = PyInt_FromLong(__pyx_v_self->_type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
+  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_NODES); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
+  if (PyObject_Cmp(__pyx_2, __pyx_3, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; goto __pyx_L1;}
   __pyx_1 = __pyx_1 == 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
     goto __pyx_L4;
   }
   /*else*/ {
-    __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_item); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L1;}
+    __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_item); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; goto __pyx_L1;}
     Py_DECREF(__pyx_v_r);
     __pyx_v_r = __pyx_2;
     __pyx_2 = 0;
   }
   __pyx_L4:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":130 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":197 */
   Py_INCREF(__pyx_v_r);
   __pyx_r = __pyx_v_r;
   goto __pyx_L0;
   __pyx_L1:;
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
-  __Pyx_AddTraceback("rbtree.rbtreeIterator.step");
+  __Pyx_AddTraceback("rbtree.rb_iterator.step");
   __pyx_r = 0;
   __pyx_L0:;
   Py_DECREF(__pyx_v_r);
   return __pyx_r;
 }
 
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator___next__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator___next__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_f_6rbtree_11rb_iterator___next__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_f_6rbtree_11rb_iterator___next__(PyObject *__pyx_v_self) {
   PyObject *__pyx_r;
   PyObject *__pyx_1 = 0;
   iter_direction __pyx_2;
   Py_INCREF(__pyx_v_self);
-  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_direction); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
-  __pyx_2 = ((iter_direction)PyInt_AsLong(__pyx_1)); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_direction); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
+  __pyx_2 = ((iter_direction)PyInt_AsLong(__pyx_1)); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
-  __pyx_1 = ((struct __pyx_vtabstruct_6rbtree_rbtreeIterator *)((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->__pyx_vtab)->step(((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self),__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
+  __pyx_1 = ((struct __pyx_vtabstruct_6rbtree_rb_iterator *)((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->__pyx_vtab)->step(((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self),__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; goto __pyx_L1;}
   __pyx_r = __pyx_1;
   __pyx_1 = 0;
   goto __pyx_L0;
   goto __pyx_L0;
   __pyx_L1:;
   Py_XDECREF(__pyx_1);
-  __Pyx_AddTraceback("rbtree.rbtreeIterator.__next__");
+  __Pyx_AddTraceback("rbtree.rb_iterator.__next__");
   __pyx_r = 0;
   __pyx_L0:;
   Py_DECREF(__pyx_v_self);
   return __pyx_r;
 }
 
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_prev(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_prev(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_f_6rbtree_11rb_iterator_prev(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_6rbtree_11rb_iterator_prev(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_r;
   PyObject *__pyx_1 = 0;
   PyObject *__pyx_2 = 0;
   static char *__pyx_argnames[] = {0};
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
   Py_INCREF(__pyx_v_self);
-  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_direction); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
-  __pyx_2 = PyInt_FromLong((-1)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
-  __pyx_3 = PyNumber_Multiply(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
+  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_direction); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; goto __pyx_L1;}
+  __pyx_2 = PyInt_FromLong((-1)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; goto __pyx_L1;}
+  __pyx_3 = PyNumber_Multiply(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
-  __pyx_4 = ((iter_direction)PyInt_AsLong(__pyx_3)); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
+  __pyx_4 = ((iter_direction)PyInt_AsLong(__pyx_3)); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  __pyx_1 = ((struct __pyx_vtabstruct_6rbtree_rbtreeIterator *)((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->__pyx_vtab)->step(((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self),__pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
+  __pyx_1 = ((struct __pyx_vtabstruct_6rbtree_rb_iterator *)((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->__pyx_vtab)->step(((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self),__pyx_4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; goto __pyx_L1;}
   __pyx_r = __pyx_1;
   __pyx_1 = 0;
   goto __pyx_L0;
   Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
-  __Pyx_AddTraceback("rbtree.rbtreeIterator.prev");
+  __Pyx_AddTraceback("rbtree.rb_iterator.prev");
   __pyx_r = 0;
   __pyx_L0:;
   Py_DECREF(__pyx_v_self);
   return __pyx_r;
 }
 
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_goto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_goto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_f_6rbtree_11rb_iterator_goto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_6rbtree_11rb_iterator_goto(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_key = 0;
   rbtree_node_t *__pyx_v_n;
   PyObject *__pyx_r;
   Py_INCREF(__pyx_v_self);
   Py_INCREF(__pyx_v_key);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":138 */
-  __pyx_v_n = rbtree_node_get(((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_T->_tree,__pyx_v_key);
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":139 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":205 */
+  __pyx_v_n = rbtree_node_get(((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_T->_tree,__pyx_v_key);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":206 */
   __pyx_1 = (__pyx_v_n == NULL);
   if (__pyx_1) {
 
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":140 */
-    __pyx_1 = PyInt_AsLong(Py_True); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; goto __pyx_L1;}
-    ((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_done = __pyx_1;
-
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":141 */
-    ((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter = NULL;
-
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":142 */
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":207 */
+    __pyx_1 = PyInt_AsLong(Py_True); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; goto __pyx_L1;}
+    ((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_done = __pyx_1;
+
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":208 */
+    ((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter = NULL;
+
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":209 */
     __Pyx_Raise(PyExc_KeyError, __pyx_v_key, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; goto __pyx_L1;}
     goto __pyx_L2;
   }
   /*else*/ {
-    ((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter = __pyx_v_n;
+    ((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter = __pyx_v_n;
   }
   __pyx_L2:;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  __Pyx_AddTraceback("rbtree.rbtreeIterator.goto");
+  __Pyx_AddTraceback("rbtree.rb_iterator.goto");
   __pyx_r = 0;
   __pyx_L0:;
   Py_DECREF(__pyx_v_self);
   return __pyx_r;
 }
 
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_3key___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_3key___get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_f_6rbtree_11rb_iterator_3key___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_f_6rbtree_11rb_iterator_3key___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_v_result;
   PyObject *__pyx_r;
   int __pyx_1;
   Py_INCREF(__pyx_v_self);
   __pyx_v_result = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":148 */
-  __pyx_1 = (((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter != NULL);
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":215 */
+  __pyx_1 = (((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter != NULL);
   if (__pyx_1) {
 
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":149 */
-    Py_INCREF(((PyObject *)((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter->key));
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":216 */
+    Py_INCREF(((PyObject *)((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter->key));
     Py_DECREF(__pyx_v_result);
-    __pyx_v_result = ((PyObject *)((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter->key);
-
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":150 */
+    __pyx_v_result = ((PyObject *)((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter->key);
+
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":217 */
     Py_INCREF(__pyx_v_result);
     __pyx_r = __pyx_v_result;
     goto __pyx_L0;
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":151 */
-  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
-  Py_INCREF(__pyx_k8p);
-  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k8p);
-  __pyx_3 = PyObject_CallObject(PyExc_KeyError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":218 */
+  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
+  Py_INCREF(__pyx_k13p);
+  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k13p);
+  __pyx_3 = PyObject_CallObject(PyExc_KeyError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   __Pyx_Raise(__pyx_3, 0, 0);
   Py_DECREF(__pyx_3); __pyx_3 = 0;
-  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
+  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
   Py_XDECREF(__pyx_2);
   Py_XDECREF(__pyx_3);
-  __Pyx_AddTraceback("rbtree.rbtreeIterator.key.__get__");
+  __Pyx_AddTraceback("rbtree.rb_iterator.key.__get__");
   __pyx_r = 0;
   __pyx_L0:;
   Py_DECREF(__pyx_v_result);
   return __pyx_r;
 }
 
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_5value___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_5value___get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_f_6rbtree_11rb_iterator_5value___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_f_6rbtree_11rb_iterator_5value___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_v_result;
   PyObject *__pyx_r;
   int __pyx_1;
   Py_INCREF(__pyx_v_self);
   __pyx_v_result = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":155 */
-  __pyx_1 = (((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter != NULL);
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":222 */
+  __pyx_1 = (((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter != NULL);
   if (__pyx_1) {
 
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":156 */
-    Py_INCREF(((PyObject *)((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter->value));
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":223 */
+    Py_INCREF(((PyObject *)((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter->value));
     Py_DECREF(__pyx_v_result);
-    __pyx_v_result = ((PyObject *)((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter->value);
-
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":157 */
+    __pyx_v_result = ((PyObject *)((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter->value);
+
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":224 */
     Py_INCREF(__pyx_v_result);
     __pyx_r = __pyx_v_result;
     goto __pyx_L0;
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":158 */
-  __Pyx_Raise(PyExc_KeyError, __pyx_k8p, 0);
-  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":225 */
+  __Pyx_Raise(PyExc_KeyError, __pyx_k13p, 0);
+  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
-  __Pyx_AddTraceback("rbtree.rbtreeIterator.value.__get__");
+  __Pyx_AddTraceback("rbtree.rb_iterator.value.__get__");
   __pyx_r = 0;
   __pyx_L0:;
   Py_DECREF(__pyx_v_result);
   return __pyx_r;
 }
 
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_4item___get__(PyObject *__pyx_v_self); /*proto*/
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_4item___get__(PyObject *__pyx_v_self) {
+static PyObject *__pyx_f_6rbtree_11rb_iterator_4item___get__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_f_6rbtree_11rb_iterator_4item___get__(PyObject *__pyx_v_self) {
   PyObject *__pyx_v_result;
   PyObject *__pyx_r;
   int __pyx_1;
   Py_INCREF(__pyx_v_self);
   __pyx_v_result = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":162 */
-  __pyx_1 = (((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter != NULL);
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":229 */
+  __pyx_1 = (((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter != NULL);
   if (__pyx_1) {
 
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":163 */
-    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; goto __pyx_L1;}
-    Py_INCREF(((PyObject *)((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter->key));
-    PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter->key));
-    Py_INCREF(((PyObject *)((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter->value));
-    PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter->value));
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":230 */
+    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
+    Py_INCREF(((PyObject *)((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter->key));
+    PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter->key));
+    Py_INCREF(((PyObject *)((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter->value));
+    PyTuple_SET_ITEM(__pyx_2, 1, ((PyObject *)((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter->value));
     Py_DECREF(__pyx_v_result);
     __pyx_v_result = __pyx_2;
     __pyx_2 = 0;
 
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":165 */
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":232 */
     Py_INCREF(__pyx_v_result);
     __pyx_r = __pyx_v_result;
     goto __pyx_L0;
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":166 */
-  __Pyx_Raise(PyExc_KeyError, __pyx_k8p, 0);
-  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":233 */
+  __Pyx_Raise(PyExc_KeyError, __pyx_k13p, 0);
+  {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
   Py_XDECREF(__pyx_2);
-  __Pyx_AddTraceback("rbtree.rbtreeIterator.item.__get__");
+  __Pyx_AddTraceback("rbtree.rb_iterator.item.__get__");
   __pyx_r = 0;
   __pyx_L0:;
   Py_DECREF(__pyx_v_result);
   return __pyx_r;
 }
 
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_f_6rbtree_11rb_iterator_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_6rbtree_11rb_iterator_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   PyObject *__pyx_v_mode = 0;
   PyObject *__pyx_r;
   PyObject *__pyx_1 = 0;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|O", __pyx_argnames, &__pyx_v_mode)) return 0;
   Py_INCREF(__pyx_v_self);
   Py_INCREF(__pyx_v_mode);
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_KEYS); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; goto __pyx_L1;}
-  if (PyObject_Cmp(__pyx_v_mode, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; goto __pyx_L1;}
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_KEYS); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; goto __pyx_L1;}
+  if (PyObject_Cmp(__pyx_v_mode, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; goto __pyx_L1;}
   __pyx_2 = __pyx_2 == 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   if (__pyx_2) {
-    __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; goto __pyx_L1;}
+    __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; goto __pyx_L1;}
     __pyx_r = __pyx_1;
     __pyx_1 = 0;
     goto __pyx_L0;
     goto __pyx_L2;
   }
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_VALUES); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
-  if (PyObject_Cmp(__pyx_v_mode, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_VALUES); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; goto __pyx_L1;}
+  if (PyObject_Cmp(__pyx_v_mode, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; goto __pyx_L1;}
   __pyx_2 = __pyx_2 == 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   if (__pyx_2) {
-    __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_value); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
+    __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_value); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; goto __pyx_L1;}
     __pyx_r = __pyx_1;
     __pyx_1 = 0;
     goto __pyx_L0;
     goto __pyx_L2;
   }
-  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_ITEMS); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
-  if (PyObject_Cmp(__pyx_v_mode, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
+  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_ITEMS); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; goto __pyx_L1;}
+  if (PyObject_Cmp(__pyx_v_mode, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; goto __pyx_L1;}
   __pyx_2 = __pyx_2 == 0;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   if (__pyx_2) {
-    __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
-    __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_value); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
-    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; goto __pyx_L1;}
+    __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_key); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; goto __pyx_L1;}
+    __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_value); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; goto __pyx_L1;}
+    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; goto __pyx_L1;}
     PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1);
     PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
     __pyx_1 = 0;
   Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_3);
   Py_XDECREF(__pyx_4);
-  __Pyx_AddTraceback("rbtree.rbtreeIterator.get");
+  __Pyx_AddTraceback("rbtree.rb_iterator.get");
   __pyx_r = 0;
   __pyx_L0:;
   Py_DECREF(__pyx_v_self);
   return __pyx_r;
 }
 
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_6rbtree_14rbtreeIterator_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+static PyObject *__pyx_f_6rbtree_11rb_iterator_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_6rbtree_11rb_iterator_delete(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
   rbtree_node_t *__pyx_v_n;
   PyObject *__pyx_r;
   PyObject *__pyx_1 = 0;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
   Py_INCREF(__pyx_v_self);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":180 */
-  __pyx_v_n = rbtree_node_del(((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_T->_tree,((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter);
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":182 */
-  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_direction); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;}
-  __pyx_2 = PyInt_FromLong(BACKWARD); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":247 */
+  __pyx_v_n = rbtree_node_del(((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_T->_tree,((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":249 */
+  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_direction); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
+  __pyx_2 = PyInt_FromLong(BACKWARD); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
   __pyx_3 = __pyx_1 == __pyx_2;
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   if (__pyx_3) {
-    __pyx_v_n = tree_predecessor(((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_T->_tree,__pyx_v_n);
+    __pyx_v_n = tree_predecessor(((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_T->_tree,__pyx_v_n);
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":184 */
-  ((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_iter = __pyx_v_n;
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":251 */
+  ((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_iter = __pyx_v_n;
 
   __pyx_r = Py_None; Py_INCREF(Py_None);
   goto __pyx_L0;
   __pyx_L1:;
   Py_XDECREF(__pyx_1);
   Py_XDECREF(__pyx_2);
-  __Pyx_AddTraceback("rbtree.rbtreeIterator.delete");
+  __Pyx_AddTraceback("rbtree.rb_iterator.delete");
   __pyx_r = 0;
   __pyx_L0:;
   Py_DECREF(__pyx_v_self);
   return __pyx_r;
 }
 
-static Py_ssize_t __pyx_f_6rbtree_14rbtreeIterator___len__(PyObject *__pyx_v_self); /*proto*/
-static Py_ssize_t __pyx_f_6rbtree_14rbtreeIterator___len__(PyObject *__pyx_v_self) {
+static Py_ssize_t __pyx_f_6rbtree_11rb_iterator___len__(PyObject *__pyx_v_self); /*proto*/
+static Py_ssize_t __pyx_f_6rbtree_11rb_iterator___len__(PyObject *__pyx_v_self) {
   Py_ssize_t __pyx_r;
   Py_ssize_t __pyx_1;
   Py_INCREF(__pyx_v_self);
-  __pyx_1 = PyObject_Length(((PyObject *)((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_T)); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
+  __pyx_1 = PyObject_Length(((PyObject *)((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_T)); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
   __pyx_r = __pyx_1;
   goto __pyx_L0;
 
   __pyx_r = 0;
   goto __pyx_L0;
   __pyx_L1:;
-  __Pyx_AddTraceback("rbtree.rbtreeIterator.__len__");
+  __Pyx_AddTraceback("rbtree.rb_iterator.__len__");
   __pyx_r = -1;
   __pyx_L0:;
   Py_DECREF(__pyx_v_self);
   return __pyx_r;
 }
 
-static int __pyx_f_6rbtree_14rbtreeIterator___nonzero__(PyObject *__pyx_v_self); /*proto*/
-static int __pyx_f_6rbtree_14rbtreeIterator___nonzero__(PyObject *__pyx_v_self) {
+static int __pyx_f_6rbtree_11rb_iterator___nonzero__(PyObject *__pyx_v_self); /*proto*/
+static int __pyx_f_6rbtree_11rb_iterator___nonzero__(PyObject *__pyx_v_self) {
   int __pyx_r;
   Py_INCREF(__pyx_v_self);
-  __pyx_r = (!((struct __pyx_obj_6rbtree_rbtreeIterator *)__pyx_v_self)->_done);
+  __pyx_r = (!((struct __pyx_obj_6rbtree_rb_iterator *)__pyx_v_self)->_done);
   goto __pyx_L0;
 
   __pyx_r = 0;
   __pyx_v_mapping = __pyx_d2;
   __pyx_v_cmp = __pyx_d3;
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|OO", __pyx_argnames, &__pyx_v_mapping, &__pyx_v_cmp)) return -1;
-  Py_INCREF(__pyx_v_self);
+  Py_INCREF((PyObject *)__pyx_v_self);
   Py_INCREF(__pyx_v_mapping);
   Py_INCREF(__pyx_v_cmp);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":197 */
-  ((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree = rbtree_alloc();
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":198 */
-  rbtree_init(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree);
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":200 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":262 */
+  ((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->__pyx_base._tree = rbtree_alloc();
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":263 */
+  rbtree_init(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->__pyx_base._tree);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":265 */
   __pyx_1 = __pyx_v_cmp != Py_None;
   if (__pyx_1) {
-    rbtree_set_compare(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree,__pyx_v_cmp);
+    rbtree_set_compare(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->__pyx_base._tree,__pyx_v_cmp);
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":203 */
-  __pyx_1 = PyObject_IsTrue(__pyx_v_mapping); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":268 */
+  __pyx_1 = PyObject_IsTrue(__pyx_v_mapping); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 268; goto __pyx_L1;}
   if (__pyx_1) {
-    __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_update); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; goto __pyx_L1;}
-    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; goto __pyx_L1;}
+    __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_update); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; goto __pyx_L1;}
     Py_INCREF(__pyx_v_mapping);
     PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_mapping);
-    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; goto __pyx_L1;}
+    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_4); __pyx_4 = 0;
   __Pyx_AddTraceback("rbtree.rbtree.__cinit__");
   __pyx_r = -1;
   __pyx_L0:;
-  Py_DECREF(__pyx_v_self);
+  Py_DECREF((PyObject *)__pyx_v_self);
   Py_DECREF(__pyx_v_mapping);
   Py_DECREF(__pyx_v_cmp);
   return __pyx_r;
 }
 
-static void __pyx_f_6rbtree_6rbtree___dealloc__(PyObject *__pyx_v_self); /*proto*/
-static void __pyx_f_6rbtree_6rbtree___dealloc__(PyObject *__pyx_v_self) {
-  Py_INCREF(__pyx_v_self);
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":207 */
-  rbtree_dealloc(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree);
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":208 */
-  rbtree_free(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree);
-
-  Py_DECREF(__pyx_v_self);
-}
-
-static PyObject *__pyx_f_6rbtree_6rbtree___getnewargs__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_6rbtree_6rbtree___getnewargs__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyObject *__pyx_v_args = 0;
-  PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
-  static char *__pyx_argnames[] = {0};
-  if (__Pyx_GetStarArgs(&__pyx_args, &__pyx_kwds, __pyx_argnames, 0, &__pyx_v_args, 0, 0) < 0) return 0;
-  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) {
-    Py_XDECREF(__pyx_args);
-    Py_XDECREF(__pyx_kwds);
-    Py_XDECREF(__pyx_v_args);
-    return 0;
-  }
-  Py_INCREF(__pyx_v_self);
-  __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;}
-  __pyx_r = __pyx_1;
-  __pyx_1 = 0;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; Py_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1:;
-  Py_XDECREF(__pyx_1);
-  __Pyx_AddTraceback("rbtree.rbtree.__getnewargs__");
-  __pyx_r = 0;
-  __pyx_L0:;
-  Py_XDECREF(__pyx_v_args);
-  Py_DECREF(__pyx_v_self);
-  Py_XDECREF(__pyx_args);
-  Py_XDECREF(__pyx_kwds);
-  return __pyx_r;
-}
-
-static PyObject *__pyx_f_6rbtree_6rbtree___getstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_6rbtree_6rbtree___getstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyObject *__pyx_v_d;
-  PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
-  PyObject *__pyx_2 = 0;
-  static char *__pyx_argnames[] = {0};
-  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
-  Py_INCREF(__pyx_v_self);
-  __pyx_v_d = Py_None; Py_INCREF(Py_None);
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":215 */
-  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
-  Py_INCREF(__pyx_v_self);
-  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_self);
-  __pyx_2 = PyObject_CallObject(((PyObject *)(&PyDict_Type)), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  Py_DECREF(__pyx_v_d);
-  __pyx_v_d = __pyx_2;
-  __pyx_2 = 0;
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":216 */
-  __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
-  if (PyDict_SetItem(__pyx_1, __pyx_n_data, __pyx_v_d) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
-  if (PyDict_SetItem(__pyx_1, __pyx_n_compare, ((PyObject *)((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree->compare)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
-  __pyx_r = __pyx_1;
-  __pyx_1 = 0;
-  goto __pyx_L0;
-
-  __pyx_r = Py_None; Py_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1:;
-  Py_XDECREF(__pyx_1);
-  Py_XDECREF(__pyx_2);
-  __Pyx_AddTraceback("rbtree.rbtree.__getstate__");
-  __pyx_r = 0;
-  __pyx_L0:;
-  Py_DECREF(__pyx_v_d);
-  Py_DECREF(__pyx_v_self);
-  return __pyx_r;
-}
-
-static PyObject *__pyx_f_6rbtree_6rbtree___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
-static PyObject *__pyx_f_6rbtree_6rbtree___setstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
-  PyObject *__pyx_v_state = 0;
-  PyObject *__pyx_r;
-  PyObject *__pyx_1 = 0;
-  int __pyx_2;
-  PyObject *__pyx_3 = 0;
-  PyObject *__pyx_4 = 0;
-  static char *__pyx_argnames[] = {"state",0};
-  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_state)) return 0;
-  Py_INCREF(__pyx_v_self);
-  Py_INCREF(__pyx_v_state);
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":223 */
-  __pyx_1 = PyObject_GetItem(__pyx_v_state, __pyx_n_compare); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; goto __pyx_L1;}
-  __pyx_2 = __pyx_1 != Py_None;
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  if (__pyx_2) {
-    __pyx_1 = PyObject_GetItem(__pyx_v_state, __pyx_n_compare); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
-    rbtree_set_compare(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree,__pyx_1);
-    Py_DECREF(__pyx_1); __pyx_1 = 0;
-    goto __pyx_L2;
-  }
-  __pyx_L2:;
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":226 */
-  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_update); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetItem(__pyx_v_state, __pyx_n_data); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
-  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
-  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
-  __pyx_3 = 0;
-  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
-  Py_DECREF(__pyx_1); __pyx_1 = 0;
-  Py_DECREF(__pyx_4); __pyx_4 = 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
-
-  __pyx_r = Py_None; Py_INCREF(Py_None);
-  goto __pyx_L0;
-  __pyx_L1:;
-  Py_XDECREF(__pyx_1);
-  Py_XDECREF(__pyx_3);
-  Py_XDECREF(__pyx_4);
-  __Pyx_AddTraceback("rbtree.rbtree.__setstate__");
-  __pyx_r = 0;
-  __pyx_L0:;
-  Py_DECREF(__pyx_v_self);
-  Py_DECREF(__pyx_v_state);
-  return __pyx_r;
-}
-
 static PyObject *__pyx_f_6rbtree_6rbtree___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_mode); /*proto*/
 static PyObject *__pyx_f_6rbtree_6rbtree___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_mode) {
   PyObject *__pyx_v_mode = 0;
   int __pyx_1;
   int __pyx_2;
   PyObject *__pyx_3 = 0;
-  Py_ssize_t __pyx_4;
+  PyObject *__pyx_4 = 0;
   Py_ssize_t __pyx_5;
-  PyObject *__pyx_6 = 0;
+  Py_ssize_t __pyx_6;
   PyObject *__pyx_7 = 0;
   PyObject *__pyx_8 = 0;
   Py_INCREF(__pyx_v_self);
   __pyx_v_s = Py_None; Py_INCREF(Py_None);
   __pyx_v_o = Py_None; Py_INCREF(Py_None);
   __pyx_v_i = Py_None; Py_INCREF(Py_None);
-  __pyx_v_mode = PyInt_FromLong(__pyx_arg_mode); if (!__pyx_v_mode) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; goto __pyx_L1;}
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":230 */
-  __pyx_1 = PyObject_IsInstance(__pyx_v_other,((PyObject *)__pyx_ptype_6rbtree_rbtree)); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; goto __pyx_L1;}
+  __pyx_v_mode = PyInt_FromLong(__pyx_arg_mode); if (!__pyx_v_mode) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; goto __pyx_L1;}
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":273 */
+  __pyx_1 = PyObject_IsInstance(__pyx_v_other,((PyObject *)__pyx_ptype_6rbtree_rbtree)); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; goto __pyx_L1;}
   __pyx_2 = (!__pyx_1);
   if (__pyx_2) {
-    __Pyx_Raise(PyExc_ValueError, __pyx_k13p, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
+    __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; goto __pyx_L1;}
+    __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n___name__); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; goto __pyx_L1;}
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    __pyx_3 = PyNumber_Remainder(__pyx_k15p, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; goto __pyx_L1;}
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    __Pyx_Raise(PyExc_ValueError, __pyx_3, 0);
+    Py_DECREF(__pyx_3); __pyx_3 = 0;
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; goto __pyx_L1;}
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":233 */
-  __pyx_3 = PyInt_FromLong(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
-  if (PyObject_Cmp(__pyx_v_mode, __pyx_3, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":276 */
+  __pyx_4 = PyInt_FromLong(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; goto __pyx_L1;}
+  if (PyObject_Cmp(__pyx_v_mode, __pyx_4, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; goto __pyx_L1;}
   __pyx_1 = __pyx_1 != 0;
-  Py_DECREF(__pyx_3); __pyx_3 = 0;
+  Py_DECREF(__pyx_4); __pyx_4 = 0;
   if (__pyx_1) {
     Py_INCREF(Py_False);
     __pyx_r = Py_False;
   }
   __pyx_L3:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":234 */
-  __pyx_4 = PyObject_Length(__pyx_v_other); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}
-  __pyx_5 = PyObject_Length(__pyx_v_self); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}
-  __pyx_2 = (__pyx_4 != __pyx_5);
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":277 */
+  __pyx_5 = PyObject_Length(__pyx_v_other); if (__pyx_5 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; goto __pyx_L1;}
+  __pyx_6 = PyObject_Length(__pyx_v_self); if (__pyx_6 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 277; goto __pyx_L1;}
+  __pyx_2 = (__pyx_5 != __pyx_6);
   if (__pyx_2) {
     Py_INCREF(Py_False);
     __pyx_r = Py_False;
   }
   __pyx_L4:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":235 */
-  __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_iternodes); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; goto __pyx_L1;}
-  __pyx_6 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":278 */
+  __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_iternodes); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
+  __pyx_4 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 278; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_v_s);
-  __pyx_v_s = __pyx_6;
-  __pyx_6 = 0;
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":236 */
-  __pyx_3 = PyObject_GetAttr(__pyx_v_other, __pyx_n_iternodes); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; goto __pyx_L1;}
-  __pyx_6 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; goto __pyx_L1;}
+  __pyx_v_s = __pyx_4;
+  __pyx_4 = 0;
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":279 */
+  __pyx_3 = PyObject_GetAttr(__pyx_v_other, __pyx_n_iternodes); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; goto __pyx_L1;}
+  __pyx_4 = PyObject_CallObject(__pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; goto __pyx_L1;}
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   Py_DECREF(__pyx_v_o);
-  __pyx_v_o = __pyx_6;
-  __pyx_6 = 0;
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":237 */
-  __pyx_3 = PyObject_GetIter(__pyx_v_self); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; goto __pyx_L1;}
+  __pyx_v_o = __pyx_4;
+  __pyx_4 = 0;
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":280 */
+  __pyx_3 = PyObject_GetIter(__pyx_v_self); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
   for (;;) {
-    __pyx_6 = PyIter_Next(__pyx_3);
-    if (!__pyx_6) {
-      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; goto __pyx_L1;}
+    __pyx_4 = PyIter_Next(__pyx_3);
+    if (!__pyx_4) {
+      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
       break;
     }
     Py_DECREF(__pyx_v_i);
-    __pyx_v_i = __pyx_6;
-    __pyx_6 = 0;
-    __pyx_6 = PyObject_GetAttr(__pyx_v_s, __pyx_n_next); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; goto __pyx_L1;}
-    __pyx_7 = PyObject_CallObject(__pyx_6, 0); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; goto __pyx_L1;}
-    Py_DECREF(__pyx_6); __pyx_6 = 0;
-    __pyx_6 = PyObject_GetAttr(__pyx_7, __pyx_n_item); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; goto __pyx_L1;}
+    __pyx_v_i = __pyx_4;
+    __pyx_4 = 0;
+    __pyx_4 = PyObject_GetAttr(__pyx_v_s, __pyx_n_next); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
+    __pyx_7 = PyObject_CallObject(__pyx_4, 0); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
+    __pyx_4 = PyObject_GetAttr(__pyx_7, __pyx_n_item); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
     Py_DECREF(__pyx_7); __pyx_7 = 0;
-    __pyx_7 = PyObject_GetAttr(__pyx_v_o, __pyx_n_next); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; goto __pyx_L1;}
-    __pyx_8 = PyObject_CallObject(__pyx_7, 0); if (!__pyx_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; goto __pyx_L1;}
+    __pyx_7 = PyObject_GetAttr(__pyx_v_o, __pyx_n_next); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
+    __pyx_8 = PyObject_CallObject(__pyx_7, 0); if (!__pyx_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
     Py_DECREF(__pyx_7); __pyx_7 = 0;
-    __pyx_7 = PyObject_GetAttr(__pyx_8, __pyx_n_item); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; goto __pyx_L1;}
+    __pyx_7 = PyObject_GetAttr(__pyx_8, __pyx_n_item); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
     Py_DECREF(__pyx_8); __pyx_8 = 0;
-    if (PyObject_Cmp(__pyx_6, __pyx_7, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; goto __pyx_L1;}
+    if (PyObject_Cmp(__pyx_4, __pyx_7, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
     __pyx_1 = __pyx_1 != 0;
-    Py_DECREF(__pyx_6); __pyx_6 = 0;
+    Py_DECREF(__pyx_4); __pyx_4 = 0;
     Py_DECREF(__pyx_7); __pyx_7 = 0;
     if (__pyx_1) {
       Py_INCREF(Py_False);
   }
   Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":239 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":282 */
   Py_INCREF(Py_True);
   __pyx_r = Py_True;
   goto __pyx_L0;
   goto __pyx_L0;
   __pyx_L1:;
   Py_XDECREF(__pyx_3);
-  Py_XDECREF(__pyx_6);
+  Py_XDECREF(__pyx_4);
   Py_XDECREF(__pyx_7);
   Py_XDECREF(__pyx_8);
   __Pyx_AddTraceback("rbtree.rbtree.__richcmp__");
   return __pyx_r;
 }
 
-static Py_ssize_t __pyx_f_6rbtree_6rbtree___len__(PyObject *__pyx_v_self); /*proto*/
-static Py_ssize_t __pyx_f_6rbtree_6rbtree___len__(PyObject *__pyx_v_self) {
-  Py_ssize_t __pyx_r;
+static PyObject *__pyx_f_6rbtree_6rbtree___getstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_6rbtree_6rbtree___getstate__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+  PyObject *__pyx_v_d;
+  PyObject *__pyx_r;
+  PyObject *__pyx_1 = 0;
+  PyObject *__pyx_2 = 0;
+  static char *__pyx_argnames[] = {0};
+  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
+  Py_INCREF((PyObject *)__pyx_v_self);
+  __pyx_v_d = Py_None; Py_INCREF(Py_None);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":286 */
+  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
   Py_INCREF(__pyx_v_self);
-  __pyx_r = ((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree->ct;
+  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_self);
+  __pyx_2 = PyObject_CallObject(((PyObject *)(&PyDict_Type)), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; goto __pyx_L1;}
+  Py_DECREF(__pyx_1); __pyx_1 = 0;
+  Py_DECREF(__pyx_v_d);
+  __pyx_v_d = __pyx_2;
+  __pyx_2 = 0;
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":287 */
+  __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; goto __pyx_L1;}
+  if (PyDict_SetItem(__pyx_1, __pyx_n_data, __pyx_v_d) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; goto __pyx_L1;}
+  if (PyDict_SetItem(__pyx_1, __pyx_n_compare, ((PyObject *)((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->__pyx_base._tree->compare)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; goto __pyx_L1;}
+  __pyx_r = __pyx_1;
+  __pyx_1 = 0;
   goto __pyx_L0;
 
+  __pyx_r = Py_None; Py_INCREF(Py_None);
+  goto __pyx_L0;
+  __pyx_L1:;
+  Py_XDECREF(__pyx_1);
+  Py_XDECREF(__pyx_2);
+  __Pyx_AddTraceback("rbtree.rbtree.__getstate__");
   __pyx_r = 0;
   __pyx_L0:;
-  Py_DECREF(__pyx_v_self);
+  Py_DECREF(__pyx_v_d);
+  Py_DECREF((PyObject *)__pyx_v_self);
   return __pyx_r;
 }
 
 static int __pyx_f_6rbtree_6rbtree___setitem__(PyObject *__pyx_v_self, PyObject *__pyx_v_key, PyObject *__pyx_v_value) {
   int __pyx_r;
   int __pyx_1;
-  Py_INCREF(__pyx_v_self);
+  Py_INCREF((PyObject *)__pyx_v_self);
   Py_INCREF(__pyx_v_key);
   Py_INCREF(__pyx_v_value);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":247 */
-  __pyx_1 = PyObject_IsInstance(__pyx_v_key,((PyObject *)(&PySlice_Type))); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":295 */
+  __pyx_1 = PyObject_IsInstance(__pyx_v_key,((PyObject *)(&PySlice_Type))); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; goto __pyx_L1;}
   if (__pyx_1) {
-    __Pyx_Raise(PyExc_ValueError, __pyx_k16p, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; goto __pyx_L1;}
+    __Pyx_Raise(PyExc_ValueError, __pyx_k19p, 0);
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 296; goto __pyx_L1;}
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":250 */
-  rbtree_add(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree,__pyx_v_key,__pyx_v_value);
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":298 */
+  rbtree_add(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->__pyx_base._tree,__pyx_v_key,__pyx_v_value);
 
   __pyx_r = 0;
   goto __pyx_L0;
   __Pyx_AddTraceback("rbtree.rbtree.__setitem__");
   __pyx_r = -1;
   __pyx_L0:;
-  Py_DECREF(__pyx_v_self);
+  Py_DECREF((PyObject *)__pyx_v_self);
   Py_DECREF(__pyx_v_key);
   Py_DECREF(__pyx_v_value);
   return __pyx_r;
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  Py_INCREF(__pyx_v_self);
+  Py_INCREF((PyObject *)__pyx_v_self);
   Py_INCREF(__pyx_v_key);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":255 */
-  __pyx_1 = PyObject_IsInstance(__pyx_v_key,((PyObject *)(&PySlice_Type))); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":303 */
+  __pyx_1 = PyObject_IsInstance(__pyx_v_key,((PyObject *)(&PySlice_Type))); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; goto __pyx_L1;}
   if (__pyx_1) {
-    __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n___doslice__); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; goto __pyx_L1;}
-    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; goto __pyx_L1;}
+    __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n___doslice__); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}
     Py_INCREF(__pyx_v_key);
     PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_key);
-    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; goto __pyx_L1;}
+    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     __pyx_r = __pyx_4;
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":258 */
-  __pyx_v_v = rbtree_get(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree,__pyx_v_key);
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":259 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":306 */
+  __pyx_v_v = rbtree_get(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->__pyx_base._tree,__pyx_v_key);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":307 */
   __pyx_1 = (__pyx_v_v == NULL);
   if (__pyx_1) {
     __Pyx_Raise(PyExc_KeyError, __pyx_v_key, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; goto __pyx_L1;}
     goto __pyx_L3;
   }
   __pyx_L3:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":260 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":308 */
   Py_INCREF(((PyObject *)__pyx_v_v));
   __pyx_r = ((PyObject *)__pyx_v_v);
   goto __pyx_L0;
   __Pyx_AddTraceback("rbtree.rbtree.__getitem__");
   __pyx_r = 0;
   __pyx_L0:;
-  Py_DECREF(__pyx_v_self);
+  Py_DECREF((PyObject *)__pyx_v_self);
   Py_DECREF(__pyx_v_key);
   return __pyx_r;
 }
   PyObject *__pyx_2 = 0;
   PyObject *__pyx_3 = 0;
   PyObject *__pyx_4 = 0;
-  Py_INCREF(__pyx_v_self);
+  Py_INCREF((PyObject *)__pyx_v_self);
   Py_INCREF(__pyx_v_key);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":265 */
-  __pyx_1 = PyObject_IsInstance(__pyx_v_key,((PyObject *)(&PySlice_Type))); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":313 */
+  __pyx_1 = PyObject_IsInstance(__pyx_v_key,((PyObject *)(&PySlice_Type))); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
   if (__pyx_1) {
 
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":266 */
-    __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n___dodeleteslice__); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;}
-    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;}
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":314 */
+    __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n___dodeleteslice__); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; goto __pyx_L1;}
+    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; goto __pyx_L1;}
     Py_INCREF(__pyx_v_key);
     PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_key);
-    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 266; goto __pyx_L1;}
+    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; goto __pyx_L1;}
     Py_DECREF(__pyx_2); __pyx_2 = 0;
     Py_DECREF(__pyx_3); __pyx_3 = 0;
     Py_DECREF(__pyx_4); __pyx_4 = 0;
 
-    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":267 */
+    /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":315 */
     __pyx_r = 0;
     goto __pyx_L0;
     goto __pyx_L2;
   }
   __pyx_L2:;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":269 */
-  __pyx_v_rc = rbtree_del(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree,__pyx_v_key);
-
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":270 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":317 */
+  __pyx_v_rc = rbtree_del(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->__pyx_base._tree,__pyx_v_key);
+
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":318 */
   __pyx_1 = (__pyx_v_rc != 0);
   if (__pyx_1) {
     __Pyx_Raise(PyExc_KeyError, __pyx_v_key, 0);
-    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 270; goto __pyx_L1;}
+    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 318; goto __pyx_L1;}
     goto __pyx_L3;
   }
   __pyx_L3:;
   __Pyx_AddTraceback("rbtree.rbtree.__delitem__");
   __pyx_r = -1;
   __pyx_L0:;
-  Py_DECREF(__pyx_v_self);
+  Py_DECREF((PyObject *)__pyx_v_self);
   Py_DECREF(__pyx_v_key);
   return __pyx_r;
 }
   PyObject *__pyx_3 = 0;
   static char *__pyx_argnames[] = {"sliceobj",0};
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_sliceobj)) return 0;
-  Py_INCREF(__pyx_v_self);
+  Py_INCREF((PyObject *)__pyx_v_self);
   Py_INCREF(__pyx_v_sliceobj);
   __pyx_v_instance = Py_None; Py_INCREF(Py_None);
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":279 */
-  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; goto __pyx_L1;}
-  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; goto __pyx_L1;}
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":327 */
+  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___class__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; goto __pyx_L1;}
+  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; goto __pyx_L1;}
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_v_instance);
   __pyx_v_instance = __pyx_2;
   __pyx_2 = 0;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":280 */
-  __pyx_1 = PyObject_GetAttr(__pyx_v_sliceobj, __pyx_n_start); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_v_sliceobj, __pyx_n_stop); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_v_sliceobj, __pyx_n_step); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; goto __pyx_L1;}
-  rbtree_do_slice(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree,__pyx_1,__pyx_2,__pyx_3,((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_instance)->_tree);
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":328 */
+  __pyx_1 = PyObject_GetAttr(__pyx_v_sliceobj, __pyx_n_start); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 329; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_v_sliceobj, __pyx_n_stop); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_v_sliceobj, __pyx_n_step); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; goto __pyx_L1;}
+  rbtree_do_slice(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->__pyx_base._tree,__pyx_1,__pyx_2,__pyx_3,((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_instance)->__pyx_base._tree);
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
 
-  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":285 */
+  /* "/home/bcsaller/Projects/rbtree/src/rbtree.pyx":333 */
   Py_INCREF(__pyx_v_instance);
   __pyx_r = __pyx_v_instance;
   goto __pyx_L0;
   __pyx_r = 0;
   __pyx_L0:;
   Py_DECREF(__pyx_v_instance);
-  Py_DECREF(__pyx_v_self);
+  Py_DECREF((PyObject *)__pyx_v_self);
   Py_DECREF(__pyx_v_sliceobj);
   return __pyx_r;
 }
   PyObject *__pyx_3 = 0;
   static char *__pyx_argnames[] = {"sliceobj",0};
   if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_sliceobj)) return 0;
-  Py_INCREF(__pyx_v_self);
+  Py_INCREF((PyObject *)__pyx_v_self);
   Py_INCREF(__pyx_v_sliceobj);
-  __pyx_1 = PyObject_GetAttr(__pyx_v_sliceobj, __pyx_n_start); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
-  __pyx_2 = PyObject_GetAttr(__pyx_v_sliceobj, __pyx_n_stop); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
-  __pyx_3 = PyObject_GetAttr(__pyx_v_sliceobj, __pyx_n_step); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
-  rbtree_do_del_slice(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->_tree,__pyx_1,__pyx_2,__pyx_3);
+  __pyx_1 = PyObject_GetAttr(__pyx_v_sliceobj, __pyx_n_start); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}
+  __pyx_2 = PyObject_GetAttr(__pyx_v_sliceobj, __pyx_n_stop); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}
+  __pyx_3 = PyObject_GetAttr(__pyx_v_sliceobj, __pyx_n_step); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; goto __pyx_L1;}
+  rbtree_do_del_slice(((struct __pyx_obj_6rbtree_rbtree *)__pyx_v_self)->__pyx_base._tree,__pyx_1,__pyx_2,__pyx_3);
   Py_DECREF(__pyx_1); __pyx_1 = 0;
   Py_DECREF(__pyx_2); __pyx_2 = 0;
   Py_DECREF(__pyx_3); __pyx_3 = 0;
   __Pyx_AddTraceback("rbtree.rbtree.__dodeleteslice__");