Fixed the index.js and documentation and debug logging