improved C++ interface