Complex mutil events handler.