A lot of this module could be inlined for performance. I want to make sure the API is stable before I go tuning things.