refactored rest service