Fix CTRL-* behavior with no matches
Minor refactoring