made changes whilst exploring cpp mememory leak