Add expectation and variance functionality