restructured some javascript functions.  looked into issue with addon reloading when ip is wrongly identified as online then goes offline again