changed swap() in EventHandler