begining translation from ipy to cpp