add getUnreadMessage, small refactoring