Changes to clean up the infrastructure for resources. Also updated spromise with a fix in promise.when