several optimizations