Major refactoring of API

Closes #15

@devcritter could you review this. I made some major changes to simplify how the content handler works and to better suit what we need for the XDS.b module. If you can't review both the PRs I just submitted, reviewing this one would be most helpful.
Thanks Hannes, good point. I think returning null is more consistent. I'l make the change.