some refactoring, more debugging code in resolve()