Refactor event. Add tests.