Now frees memory on exit