refactored repository service