add minor optimizations