HW6 Part 2
Adapt code
Added analytics codes