#151 and #149. Changes to factoryOf