Refactor main query for finding unread entries
Refactor main query for finding unread entries

This needs a bit more cleanup but this should perform a lot better once
the data in the relevant tables starts piling up.

lreeves/feedcram,lreeves/feedcram,lreeves/feedcram