Decreased the number of loops for E(x)