Refactor the repo