updated purity  helper