Massive refactor of Promise and resource loading system. The new system allows module resources to be preloaded so that the module definition does not need to handle Promises