Fixed up and finished background model calculation.  Also modified JSON saving scheme to be more memory efficient