Improve demo

These patches stem from some initial observations of the demo files, see each commit message for more detailed info.