The team prepares to extract the Shadow King from David's mind. Meanwhile, D3 has plans of its own, and Oliver remembers Melanie.