Completed ex3_5:flatten