Rewrote the demo to conform to the new coding style.