Add rule-based selection and clean up various unused code
Missing newline
Correct several behaviors
Document rules
Missing newline
Update test selection example