Made some minor changes towards multithreading