first attempt at HW3 Part 2