Clean up and document formerly-duplicated code for dismissing overlay.