update hw1 code part II.4