Early draft

I'm not suggesting that we merge any of this but a PR makes it easier to discuss.
Shouldn't result and success be vals instead of vars? It doesn't look like you're reassigning them anywhere.