resolver refactored slightly