condensed more of the code fron the unread/read button.