Should this be
if(!root)
  return; 

If not we should just remove it since you are declaring var dust = {} one line above this code