modified the purge pipeline script