diff --git a/juno_samples/edge_detection/benches/edge_detection_bench.rs b/juno_samples/edge_detection/benches/edge_detection_bench.rs
index 760352754ccd39df878fa45523c5b7e76dd84f98..49e67a29b4a23ae142318623e59207e4847b7495 100644
--- a/juno_samples/edge_detection/benches/edge_detection_bench.rs
+++ b/juno_samples/edge_detection/benches/edge_detection_bench.rs
@@ -88,8 +88,6 @@ fn edge_detection_bench(c: &mut Criterion) {
                         height as u64,
                         width as u64,
                         gs as u64,
-                        sz as u64,
-                        sb as u64,
                         input_h.to(),
                         gaussian_filter_h,
                         structure_h,
diff --git a/juno_samples/edge_detection/src/cpu.sch b/juno_samples/edge_detection/src/cpu.sch
index 64fee6b648c6fc0e17b39677353e442b4b37596e..34431711516635f2a0cfd2e2f24213fdd9f7d25c 100644
--- a/juno_samples/edge_detection/src/cpu.sch
+++ b/juno_samples/edge_detection/src/cpu.sch
@@ -134,7 +134,9 @@ if !feature("seq") {
   reject_zero_crossings = reject_zero_crossings_body;
 }
 
-async-call(edge_detection@le, edge_detection@zc);
+if !feature("seq") {
+  async-call(edge_detection@le, edge_detection@zc);
+}
 
 fork-split(gaussian_smoothing, laplacian_estimate, zero_crossings, gradient, reject_zero_crossings);
 unforkify(gaussian_smoothing, laplacian_estimate, zero_crossings, gradient, reject_zero_crossings);
diff --git a/juno_samples/edge_detection/src/edge_detection.jn b/juno_samples/edge_detection/src/edge_detection.jn
index 3e49cb365b186037cf6f380c3aa6a4d3b483fb5b..da1977b67ec809ae0b81cbe0873e0a8552912897 100644
--- a/juno_samples/edge_detection/src/edge_detection.jn
+++ b/juno_samples/edge_detection/src/edge_detection.jn
@@ -13,12 +13,9 @@ fn gaussian_smoothing<n, m, gs : usize>(
 
       @filter_loop for i = 0 to gs {
         for j = 0 to gs {
-          let val = input[if row + i < gr               then 0
-                          else if row + i - gr > n - 1  then n - 1
-                                                        else row + i - gr,
-                          if col + j < gr               then 0
-                          else if col + j - gr > m - 1  then m - 1
-                                                        else col + j - gr];
+          let br = min!(max!(row + i, gr) - gr, n - 1);
+          let bc = min!(max!(col + j, gr) - gr, m - 1);
+          let val = input[br, bc];
           smoothed += val * filter[i, j];
         }
       }
@@ -33,10 +30,11 @@ fn gaussian_smoothing<n, m, gs : usize>(
 const MIN_BR : f32 = 0;
 const MAX_BR : f32 = 1;
 
-fn laplacian_estimate<n, m, sz: usize>(
+fn laplacian_estimate<n, m : usize>(
   input: f32[n, m],
-  structure: f32[sz, sz],
+  structure: f32[3, 3],
 ) -> f32[n, m] {
+  const sz = 3;
   const r = sz / 2;
 
   @res let result : f32[n, m];
@@ -77,10 +75,11 @@ fn laplacian_estimate<n, m, sz: usize>(
   return result;
 }
 
-fn zero_crossings<n, m, sz: usize>(
+fn zero_crossings<n, m : usize>(
   input: f32[n, m],
-  structure: f32[sz, sz],
+  structure: f32[3, 3],
 ) -> f32[n, m] {
+  const sz = 3;
   const r = sz / 2;
 
   @res let result : f32[n, m];
@@ -123,11 +122,12 @@ fn zero_crossings<n, m, sz: usize>(
   return result;
 }
 
-fn gradient<n, m, sb: usize>(
+fn gradient<n, m : usize>(
   input: f32[n, m],
-  sx: f32[sb, sb],
-  sy: f32[sb, sb],
+  sx: f32[3, 3],
+  sy: f32[3, 3],
 ) -> f32[n, m] {
+  const sb = 3;
   const sbr = sb / 2;
 
   @res let result : f32[n, m];
@@ -191,18 +191,18 @@ fn reject_zero_crossings<n, m: usize>(
 }
 
 #[entry]
-fn edge_detection<n, m, gs, sz, sb: usize>(
+fn edge_detection<n, m, gs: usize>(
   input: f32[n, m],
   gaussian_filter: f32[gs, gs],
-  structure: f32[sz, sz],
-  sx: f32[sb, sb],
-  sy: f32[sb, sb],
+  structure: f32[3, 3],
+  sx: f32[3, 3],
+  sy: f32[3, 3],
   theta: f32,
 ) -> f32[n, m] {
   let smoothed = gaussian_smoothing::<n, m, gs>(input, gaussian_filter);
-  @le let laplacian = laplacian_estimate::<n, m, sz>(smoothed, structure);
-  @zc let zcs = zero_crossings::<n, m, sz>(laplacian, structure);
-  let gradient = gradient::<n, m, sb>(smoothed, sx, sy);
+  @le let laplacian = laplacian_estimate::<n, m>(smoothed, structure);
+  @zc let zcs = zero_crossings::<n, m>(laplacian, structure);
+  let gradient = gradient::<n, m>(smoothed, sx, sy);
   let maxgrad = max_gradient::<n, m>(gradient);
   return reject_zero_crossings::<n, m>(zcs, gradient, maxgrad, theta);
 }
diff --git a/juno_samples/edge_detection/src/lib.rs b/juno_samples/edge_detection/src/lib.rs
index aa44e2e7e7215ee21560fefefc8c748610e183ce..3eaf38dc34f1b4bb12bbc95c1739a58cdcc41825 100644
--- a/juno_samples/edge_detection/src/lib.rs
+++ b/juno_samples/edge_detection/src/lib.rs
@@ -195,8 +195,6 @@ pub fn edge_detection_harness(args: EdgeDetectionInputs) {
                     height as u64,
                     width as u64,
                     gs as u64,
-                    sz as u64,
-                    sb as u64,
                     input_h.to(),
                     gaussian_filter_h.to(),
                     structure_h.to(),