hw8 added code for ex1