Finished hw1 code