Make the reconnect tries mean reconnect tries. Change the confusing do while loop into a snazzy for loop.