change from manual toggling to automatic toggling

solving the probable Debug = True or False Problems For ever..!!