Refactoring element handlers