fixes #20 (closed) and implements the suggestions of #22 (closed)
The legend isn't perfect yet, but usable.