Reconnect and code clean-up

Change-Id: I7ff9072c3fb7b9ad1787bf5bed5d2c82588f9c99
Example using generators

Change-Id: I746f997655fccef9bb5a9737165b9554545bf282