updated code ex1