more optimizations to v2.0 branch