Added debug-mode helper function