seperated category legend script out