Added thread monitoring