Actually got this to work with factory pattern