Updated for events-based api