optimized code sample 1 added