refactored RepositoryFactory