added purge functionality