Refactored rest server