single- and multithreaded modes