Updated with HW4 Part 2, final version