numerous performance optimizations