Added multi thread option