changed multithreading to prevent display issues