fixing up factory instantiation