Basic cleanups

First batch of cleanups from a *very* quick review.  

The second example dumps a ton of output to the console.  Haven't had time to look at whether it's the example or documentation that needs fixing.