Multithread

slight change on how to divide task among threads