Fixed timing issues and made the code more tolerant to slow loading connections.
Threading issue fixed