Modified for HW4 Part 2