added legend support