Fixes and enhancements for use in embedded environments (IAR).  Tests currently fail on Linux.
Made tests work (fixed one bug that somehow made it into this rev even though I already fixed it once, one bug that had to do with my understanding of the undocumented api :)
Should be good to pull.
A little beautification
Merge pull request #8 from dumpernet/master

Many updates and bugfixes (and some leftover stylistic diffs)