ability to return a factory instance from a function