change server logic to multi-threaded