refactoring the server-side model