generate code in sample #3