Added JSON object factory and tweaked a bunch of things.