exact diagonal working for both J and K; still need to do some major vectorization