refactor to expose the resolving logic