Added a working example to the introduction. Some other cosmetic changes and bits and bobs.