added new threadhandling