moves repo-fetching function into repo class