Do legend correctly