added the CPP part (not finished yet)