Refactored some code
Fixed update of total unread entries