continue updating ec calculation code