Optimized code for sample apps.