cleaned up some code in index.js