refactor of repository