Repositories refactor