added more threading stuff