Implemented the server logic