doing hw2 (5, 6 and part of 3 not finished)