Fix prefix matching

Fixes prefix_matching to A) Return keys instead of values and B) Return them in alphabetical order. Nice.