adding spin code