Code for Hw4