added 'debug' mode functionality to disable console messages