Revised the library, using test driven development. The public API has changed, for more details read the documentation.