Clean-up (including code licence and README)

Using the correct sort of loop in nesting level calculation.  Also made the layout of the demo page clearer, removed un-needed code, updated the licence and README.