Recoded parts base on the updated EventDispatcher.js