updated resolve impl with some refactoring