change flows example to be multithreaded