Added SPI write code