Re-wrote wiring API to be easier to understand/use