add debug capability

More debugging, with a flag