refactor wax event handler