Refactored Repo code to use an interface