use EventEmitter and better url handling