decrease reference counts on PyObject pointers

also clean up code a bit
a bit more clean up in new cpp python potential wrapper