Temp workaround for multithreading
Remove some unnecessary code.
Merge current multithread branch.