made the construction of the complex(ish) json object less of a hack