sort entries before use

With this change, "wind" in the high-priority section won't stop "windows" in the normal-priority section from getting substituted.
prioritize per-story entries over all-stories ones
3949