hw9 added code for ex1