refactored the JSON so the javascript function takes care of everything