Bugfix: the array key is attr_id, not id.
Remove dead code.
Rework toggle buttons.