Merging Patrick's work on C++ interface.