Second homework + copied the stuff we wrote in class for completeness