refactor the repository and higher abstraction