implemented legend.