Merged SPI and API, cleanups