Refactor to SPI