Added event emitter and some template events.