The purpose was to find the loop over quadrature weights in the loop nest. Unless someone proves that interchanging it with the dofs loops is beneficial in terms of performance, we can assume this loop to be always the outermost. The code was also broken in case we had coefficients.