Small modification to timeout routine and restarting sub threads.