changed to json and added ability to change content type