added proper logic for failures/success of sending a message.