Trying to wrap my head around promises and generators