optimizations and more metrics