Move code for creating the index to base.js