Restructured the computation and data handling to make computation initially and prepare the json to be served back to page when requested rather than performing computation on the fly.