ported the first step into C++