Nested class for event control