Set up eye icon for toggling visibility
Add .DS_Store to .gitignore
Initialize visibility toggles based on state
Initialize control states in a neater way
Select last control in case one is not selected

Tidied up code a bit as well.
Remove debug print
Separate legend create and update

This gets rid of the cyclic nastiness.
Update url when visibility is toggled
Clear up legend styling

Fixed capitalization etc.