Refactoring behaviors and events