Refactor repository setup