Refactoring the repository