Fixes global size issue, adds #pragma unroll to loops