method of conditional moments. added some features.