added legend output file