events and namespace refactoring