all steps of models now in cpp
fixed bugs in cpp version now matches r version