add optimized code