Cleanups and reversions of some HG changes
some more cleaning and updating
merge resolution