Add some demo code and tidy a bit