Slight cleanup of old db queries, and modified category unread count query