Some Changes.
Fixed threading