various smaller optimizations