add getUnreadMessage, small refactoring

add getUnreadMessage (#1)