small optimizations and style