Working on purge logic