refactor spinner