remove some unneeded thisses
Made legend work generic
Some layout changes to legend