adding minor optimizations