fixed program model switch, light / mats uniform inits, various refactorings