add ex5 code