port changes from ecc branch