Homework 2 code