instead of thread.sleep() why dont you just put all the code together in the same thread?