Refactor to Repo