Added new helper function calculate-em.