Here is the code!

First draft of code.  Hopefully.