small speed optimizations