completed ex3 and ex6