Moved JSON functions to bottom