Did some preliminary work on SPI functions