changed repo to trait and refactored