Fixed baseDir error and allowing custom directory

I've updated the index.js file to fix the baseDir error. I've also allowed for a custom directory to be set.