Looked quickly at updating this, but it's non-trivial and I'm not interested in maintaining this further.