added multithread realization