Factors a lot of the API code out into separate files,
to keep the codebsae cleaner and easier to follow.