Add an API, finish 2.2

I suck at writing APIs, eeek.