spin refactoring