added optional dependency injection to index.js