Ecc refactoring