Rewrote some script includes to properly use the JSON API.