repositories refactor