massive changes for handling unread vs read and sorting