added support for toggling (not 100%  working yet)
also renumbered things so everything starts at 0