I like the second option for refactoring the code. I think it is doable.
And where is your code on Github?
It's not on Github, but on my own Gitlab (a self-hosted open-source alternative to github). You can find it here [0]. I'm using two repos: one is a clone of madlib, the other contains my reports, my test script and other stuff.