diff --git a/meanshift.cpp b/meanshift.cpp
index eef50eb37432365724ab10b68c0e3d5871cb3110..a3dfda00b9bed639b975d758cdd4d9171a1883bf 100644
--- a/meanshift.cpp
+++ b/meanshift.cpp
@@ -136,8 +136,13 @@ void Grouper::group(py::list l){
   ctype coords_to_check = _coordinates;
 
   while (coords_to_check.size() > 0){
-    auto idx_cluster = neighbourhood_points(coords_to_check[0], _coordinates, _groupingDistance);
-    auto idx_cluster_to_remove = neighbourhood_points(coords_to_check[0], coords_to_check, _groupingDistance);
+    std::vector<unsigned> idx_cluster;
+    std::vector<unsigned> idx_cluster_to_remove;
+#pragma omp parallel
+{
+    idx_cluster = neighbourhood_points(coords_to_check[0], _coordinates, _groupingDistance);
+    idx_cluster_to_remove = neighbourhood_points(coords_to_check[0], coords_to_check, _groupingDistance);
+}
     unsigned n = 0;
     for (auto idx : idx_cluster_to_remove){
       coords_to_check.erase(coords_to_check.begin() + idx - n);