Refactoring Repository file