multithread; other tweaks