added lots of changes.
ready for John W to test