Various fixes and enhancements around documents selection