added hw4. This one was pretty hard.