added several optimizations