restore caching and old complexity of #resolve