Improved cluster computation to avoid timeout problems.