refactoring of repository