A few small optimizations