Made addEvent work