clean up server logic