fixed bugs and calculates now purity and eff