Added minor optimizations