Fixed most outstanding issues

I'm confident this is sort of production-ready.