Updated the server logic