A few changes made to the JSONModel, rest is just general cleanup.

JSONModel is now more central. Code duplication reduced somewhat. Should
now handle the different errors more easily.