extensive changes

too many to describe!