Finished problem6