Some changes to the EMD code. Works again however, but always has 12 IMFS