Added debug function control