Made index.js work, so that it can be used programmatically.