Did a couple of minor optimizations