consider multithread solution