added lots of changes.
ready for John W to test
tidying up
Merge remote-tracking branch 'origin/master'