Added first version of the EM calculations