Refactor repository structure