Did some performance optimizations