 }
 
 
-// TODO: Try to load values from aux-array only once and use them multiple times!
 __global__
-void coeffs_from_previous_layer_conv(const float_type* __restrict__ expr_inf_coeff, const float_type* __restrict__ expr_sup_coeff, float_type* __restrict__ res_inf_coeff, float_type* __restrict__ res_sup_coeff, const float_type* __restrict__ aux_coeffs, const size_t num_out_neurons_last_layer, const size_t output_size_x, const size_t output_size_y, const size_t output_size_z, const size_t input_size_x, const size_t input_size_y, const size_t input_size_z)
+void coeffs_from_previous_layer_conv(const float_type* __restrict__ expr_inf_coeff, const float_type* __restrict__ expr_sup_coeff, float_type* __restrict__ res_inf_coeff, float_type* __restrict__ res_sup_coeff, const float_type* __restrict__ aux_coeffs, const size_t output_size_x, const size_t output_size_y, const size_t output_size_z, const size_t input_size_x, const size_t input_size_y, const size_t input_size_z, const size_t filter_size_x, const size_t filter_size_y, const size_t stride_x, const size_t stride_y, const size_t pad_x, const size_t pad_y)
 {
     const size_t n = blockIdx.x;
 
-    for(size_t inp_x = 0; inp_x < input_size_x; inp_x++)
-    {
-        for(size_t inp_y = 0; inp_y < input_size_y; inp_y++)
-        {
-            for(size_t inp_z = 0; inp_z < input_size_z; inp_z++)
-            {
-                const size_t j = inp_x*input_size_y*input_size_z + inp_y*input_size_z + inp_z;
-                const size_t b = n*input_size_x*input_size_y*input_size_z + j;
-
-                float_type inf_coeff = 0;
-                float_type sup_coeff = 0;
-
-                float_type tmp1, tmp2;
-                float_type maxRes, maxMul;
-
-                for(size_t out_x = 0; out_x < output_size_x; out_x++)
+    float_type tmp1, tmp2;
+    float_type maxRes, maxMul;
+
+    for(size_t out_x = 0; out_x < output_size_x; out_x++)
+    {
+        for(size_t out_y = 0; out_y < output_size_y; out_y++)
+        {
+            for(size_t out_z = 0; out_z < output_size_z; out_z++)
+            {
+                const size_t i = out_x*output_size_y*output_size_z + out_y*output_size_z + out_z;
+
+                const size_t a = n*output_size_x*output_size_y*output_size_z + i;
+
+                for(size_t inp_x = 0; inp_x < input_size_x; inp_x++)
                 {
-                    for(size_t out_y = 0; out_y < output_size_y; out_y++)
+                    for(size_t inp_y = 0; inp_y < input_size_y; inp_y++)
                     {
-                        for(size_t out_z = 0; out_z < output_size_z; out_z++)
+                        for(size_t inp_z = 0; inp_z < input_size_z; inp_z++)
                         {
-                            const size_t i = out_x*output_size_y*output_size_z + out_y*output_size_z + out_z;
-
-                            size_t a = n*output_size_x*output_size_y*output_size_z + i;
-                            size_t c = i*input_size_x*input_size_y*input_size_z + j;
+                            const size_t j = inp_x*input_size_y*input_size_z + inp_y*input_size_z + inp_z;
+
+                            const size_t b = n*input_size_x*input_size_y*input_size_z + j;
+                            const size_t c = i*input_size_x*input_size_y*input_size_z + j;
 
                             const float_type prev_inf_coeff = expr_inf_coeff[a];
                             const float_type prev_sup_coeff = expr_sup_coeff[a];

                            {
                                elina_double_interval_mul_expr_coeff(&tmp1, &tmp2, prev_inf_coeff, prev_sup_coeff, -aux_coeffs[c], aux_coeffs[c]);

                                maxRes = fmax(fabs(inf_coeff), fabs(sup_coeff));
                                maxMul = fmax(fabs(tmp1), fabs(tmp2));

                                inf_coeff = inf_coeff + tmp1 + (maxRes + maxMul)*ulp;
                                sup_coeff = sup_coeff + tmp2 + (maxRes + maxMul)*ulp;
                            }
                        }
                    }
                }

                res_inf_coeff[b] = inf_coeff;
                res_sup_coeff[b] = sup_coeff;
            }
        }
    }

}


long int offset_y = 0;
long int offset_x = 0;

long int length_y = 0;
long int length_x = 0;

long int shift_y = 0;
long int shift_x = 0;


__device__
void elina_double_interval_mul(float_type* const a_inf, float_type* const a_sup, const float_type b_inf, const float_type b_sup, const float_type c_inf, const float_type c_sup)
{
