Optimizations and fix implementations