Added error text, and added Thread counting conditions