Doc fix
Optimizations and fixes