Re-write

I saw that this repo still gets quite a few views so I figured I should
fix most of my terrible code by replacing it with less terrible code.