refactor repositories