port changes from ecc branch
pull changes across from ecc branch.
pull changes across from ecc branch.