Unrolling and pipelining the loops a bit