Added atexit code.