Multithread support(need to test)