Added check for descriptor and using JSON.parse instead of raw json from response