add debug variable to turn on/off console logging