Started writing some boilerplate code.
Wrote a beta solver thing.
I have something that returns sensible values!
This works better and is more sane.

Messy as hell though.