Added localStorage support for persistance across refreshes/disconnections.