Add debug code to index.js