update legend style and functionality