Refactor spec index read