Added boilerplate code for purity correction