added legend and hint functionality