Host and Role filtering improvements

Please read the README for a description of how Host and Role filtering (better now called on-filtering) works and is used. CHANGELOG contains the tl;dr

Picked off some minor code readability improvements as I made these changes.