fixed some sorting, text processing, and matching