Toggling States DONE
Added command looping function