Updated Functions to return JSON.