update pseudocode for multithreading