added hw4 code