spin: refactoring