removed first loop unrolling because it could be written shorter