added legend feature