updated threading to own thread wrapper