Tried to avoid memory leak: clearAll during handleTeminated.