refactor the repositories