refactor the spin index