Rewrite wg purge, make it less resource intensive.