edm refactor