index.js with some logic error in updating index. needed a queue to tackle asynchronous callbacks.