tweaks to CPP code