minor refactoring to match event handler pattern.