Added in code from cloudburst.