Major refactoring of the way the API works.