Move emitEvents up to match coding style.