inner and outer done for cnf_dmv.py, seems to work. todo: reestimation for cnf