Port of 2013 code to C++