added debugging switch