refactor repostories