less hardcoded legend code