Unrolling some loops to try and gain speed.

I have no idea if this is going to work yet, since I need to compile it locally. If anyone tests this before me, use at your own risk.