Solved threading issues

Finally solved threading issues thanks to the explation of the Sleep(1)
meaning