tweaks to sorting, filtering and counting