Fixed double loops and @wraps