changed loop order and unrolled 4 times