moving some things to debug.js