use console.log and console.error instead of `util.debug`

and some a little bit clean up