Reinstated exit functions, sorta works. Doesnt actually delete:(