Updated to clean up on exit.