Reorganize code. Start demo program