added hw7 code