WIP - cleanup index.js a bit