Refactor Code
Deal with lost connections better