Adding purge function