revised hw2.4 & hw2.6