refactoring ecb cut and paste