I figured it out, will resubmit and add comments inline