Lots of tidying, and converting over to using "Result" and JSON
properly.