refactored the REST service