Now we have result.resolve() for all possible cases. So I think we should call it only once at the top of this local function instead of three separate places.