Small cleanup.
Various changes.
Reset nextPeriodic on transitioning to connected.