improved m_ops handling for heterodyne and homodyne
added type info on return values
rename d2_factors to dW_factors