Finished coding multi-thread update

Finished coding multi-thread update
rewrite some function to fit for multi-thread update