full externalization + cleanup