Removed duplicate code from index.js