Use models.length instead of hard-coded value for model count. Fix funding code count