Improve cpp version of the converter