improved and optimized _.resolve