Updated for ribboned layers to group legends properly