use a factory function as a loader