finalizing extract code