SPI code, looks like it works