added legend in tabs; capability for topic legends