Moved completion logic outsize src loop.