refactored service layer