refactoring repositories