Changes to make example work from Chris Coles.