Improvements in C++ and python bindings