everything in this function is done in the args to let.  While this works, its very confusing and is kind of brittle.  the _ is ok for quick one offs.  I would rethink how this one is done, perhaps making the args to let be abstract functions or atoms to hold states, and then do the procedural stuff in the body?