Refactor to C++.