build in a new thread so that the web server is not blocked