Better handling of JSON

Data is being appended to html from separate .js file