Attempt at implementing purging