modify some functions to use multithread