changing the handling of the index.js to use the buffer