Refactor event and spi related classes into their own package to match the API and reduce complexity.