some cleanup of the json parsing