Refactored the Repository