added unrolls and other optimizations