refactor the repository access