add purity calculations