Fixed CSS problem

Had to revert adding Legend div via append rather than after
Removed dead and obsolete code