allow debug flag/level to be passed in