Optimized code for different tasks