Made the resource-loading and startup process better, using deferreds.