hw8 added code for ex2