Changed to achieve thread-safety by using a single-threaded asio service.