Improved thread handling - now all threads actually end
Added credentials