Moved more code out of the index