Re-implement connect functionality with events