add resolve convenience function to util
fix test case
more refactor for readability

breaking out of nesting promises too much