This code is absolutely horrendous in its current state, with poor error
handling (where it's even present) and memory leaks galore. USE AT YOUR
OWN RISK. I certainly won't be publishing it anywhere or speaking of it
until it's in a much better state.