Extended the logic to allow for a callback to be called once the message either times out automatically or the user closes the message dialog manually.