used concurrent.futures for multithreading. It is taking a lot of time as well. Have to optimize it soon.