refactor repository