add ex2 code