Updating javascript to match backend