I think this about wraps up everything. This fixes the sorting and highlighting in general.