Lots of changes as suggested by SD.