Misc fixes to sample code.
Fix sample code base on feedback.
Fix sample code based on feedback.
Misc fixes to sample code.
Update sample code per Patrick's suggestion
Merge pull request #2063 from PatMahoney/master

Misc fixes to sample code.