Clean up example; minor refactoring.