Factor out spin_x() function