changed name of inner/outer loop variables. Included clean initialization of all model data and init variables