still having some problems (crash - undefined instruction)
but at least the c++ part seems to be what i wanted it to