add unread posts functionality, refactor code to fit the functionality