refactored the example into the server