moved most of the model state vars from modelgen to model