                , coords_ref.data()
                , sizeof(float) * n_cols
                , cudaMemcpyHostToDevice);
-      //TODO honor boxlimits (-> rng & offset)
+      // prune range for faster computation
+      auto min_max_box = Tools::Clustering::min_max_box(blimits
+                                                      , coords_ref[0]
+                                                      , radii[0]);
+      unsigned int offset = min_max_box.first * BSIZE;
+      unsigned int rng = (min_max_box.second-min_max_box.first+1) * BSIZE;
       in_radius <<< rng
                   , BSIZE
                   , 0

             , d_pops
             , sizeof(float) * n_rows * n_radii
             , cudaMemcpyDeviceToHost);

    //TODO sort tmp_pops into pops

    cudaFree(d_sorted_coords);
    cudaFree(d_radii2);
    cudaFree(d_pops);

      cudaFree(d_in_radius[s]);
      cudaFree(d_coords_ref[s]);
    }
    return pops;
  }

  Pops
