some minor optimizations