Refactored the getUnreadSMS method