Improve sample code

Fix one error and improve code simplicity in example.

Not sure whether it's okay to submit pull requests here, or if everything is supposed to happen on Codeplex? (You seem to be using GitHub's issues, so I thought here might be okay.)