refactoring Container, adding support for onEvent methods