optimized code structure