finished making code more oo. Added json object recival code