implemented better examples for on connect handling