Now dat_invN is precomputed instead of being computed every time inside the inner loop