Copy from simple-edm