Implement MeanComp and minor refactor