UNSTABLE: time for a commit; added code to handle legend items as tables so wrapping onto next line is sane, lots of things broken though