First draft of solution
Added comments
Checked against data

Fully annotated, checked results with test matrix