Test suite, inline docs, more style changes

This is a replacement of #20 adding a simple async test suite, and more code reorg. I can clean these commits up if need be.