Replace hardcoded sleep with actually checking whether the webserver started