refactoring with event message system