cleaned up EMD