Refactore the repo