Added demo code.

Added most of the code for the demo. TODOs are for things that don't yet
work.