* more comprehensive tests
* implement in C for speed?
* better documentation
