Optimized implementation code