major updates to C++ code and Python interface and docs