repository refactor