Minor reorganization of demo code.