completed EM derivation