partial implementation of legend