improved cluster calculation