small code optimizations