Rework some of the dependency module to use a factory for the repositories.