purge function copmlete