Dealing with lost connections and adding functionality to the Stop button