Reorganize and cleanup demo code.