Added atexit shutdown termination.