Factor out cpp util