Fixes after review

* Made sure the header can be pressed to unselect as well
* Optimized traversing of the document for selected items