changed from typefactory to varfactory