Added misc optimizations