Ugly multithreading