improve legend