Added rules for examples.
Fixed code for reconnection.